Get workspace agent external auth
GET
CoderSessionTokenheader
Coder-Session-Token<token>match*stringMatch
id*stringProvider ID
listen?booleanWait for a new token to be issued
OK
application/json- response
access_token?stringexpires_at?stringExpiresAt is the time the token expires, normalized to UTC (for example, "2024-06-01T15:04:05Z"). Zero value means no expiry.
password?stringtoken_extra?type?stringurl?stringusername?stringDeprecated: Only supported on /workspaceagents/me/gitauth
for backwards compatibility.
The samples read CODER_URL and CODER_SESSION_TOKEN: set up your environment.
curl -X GET \ "$CODER_URL/api/v2/workspaceagents/me/external-auth?match={match}&id={id}" \ -H "Coder-Session-Token: $CODER_SESSION_TOKEN"const { CODER_URL, CODER_SESSION_TOKEN } = process.env;const url = `${CODER_URL}/api/v2/workspaceagents/me/external-auth?match={match}&id={id}`;const response = await fetch(url, { method: "GET", headers: { "Coder-Session-Token": CODER_SESSION_TOKEN, },});console.log(response.status, await response.text());import osimport requestsurl = ( os.environ["CODER_URL"] + "/api/v2/workspaceagents/me/external-auth?match={match}&id={id}")token = os.environ["CODER_SESSION_TOKEN"]response = requests.get( url, headers={ "Coder-Session-Token": token, },)print(response.status_code, response.text)package mainimport ( "fmt" "io" "net/http" "os")func main() { url := os.Getenv("CODER_URL") + "/api/v2/workspaceagents/me/external-auth?match={match}&id={id}" token := os.Getenv("CODER_SESSION_TOKEN") req, err := http.NewRequest(http.MethodGet, url, nil) if err != nil { panic(err) } req.Header.Set("Coder-Session-Token", token) resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() out, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(resp.Status, string(out))}Example Response200
{ "access_token": "string", "expires_at": "string", "password": "string", "token_extra": {}, "type": "string", "url": "string", "username": "string"}