CheckAuthenticationForHost
client.Runners.CheckAuthenticationForHost(ctx, body) (*RunnerCheckAuthenticationForHostResponse, error)
POST/gitpod.v1.RunnerService/CheckAuthenticationForHost
Checks if a user is authenticated for a specific host.
Use this method to:
- Verify authentication status
- Get authentication URLs
- Check PAT support
Examples
-
Check authentication:
Verifies authentication for a host.
host: "github.com"
CheckAuthenticationForHost
package main
import (
"context"
"fmt"
"github.com/gitpod-io/gitpod-sdk-go"
"github.com/gitpod-io/gitpod-sdk-go/option"
)
func main() {
client := gitpod.NewClient(
option.WithBearerToken("My Bearer Token"),
)
response, err := client.Runners.CheckAuthenticationForHost(context.TODO(), gitpod.RunnerCheckAuthenticationForHostParams{
Host: gitpod.F("github.com"),
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Authenticated)
}
{
"authenticated": true,
"authenticationUrl": "authenticationUrl",
"patSupported": true,
"scmId": "scmId",
"scmName": "scmName",
"supportsOauth2": {
"authUrl": "authUrl",
"docsUrl": "docsUrl"
},
"supportsPat": {
"createUrl": "createUrl",
"docsUrl": "docsUrl",
"example": "example",
"requiredScopes": [
"string"
]
}
}Returns Examples
{
"authenticated": true,
"authenticationUrl": "authenticationUrl",
"patSupported": true,
"scmId": "scmId",
"scmName": "scmName",
"supportsOauth2": {
"authUrl": "authUrl",
"docsUrl": "docsUrl"
},
"supportsPat": {
"createUrl": "createUrl",
"docsUrl": "docsUrl",
"example": "example",
"requiredScopes": [
"string"
]
}
}