Appearance
Login authorize
Finishes sign-in and returns tokens plus the user's name and email.
Send either an authorization code from Start login, or a username and password.
POST /fieldservicegateway/usermanagement/v3/oauth/login/authorize
Request
| Field | Type | Required | Description |
|---|---|---|---|
app_client_id | string | yes | Same client id used to start login |
redirect_uri | string | yes | Same redirect address used to start login |
code | string | one sign-in method | Authorization code from the login callback |
username | string | one sign-in method | Username for a password sign-in |
password | string | with username | Password for a password sign-in |
code_verifier | string | when PKCE was used | 43–128 characters. Required if start login sent a code challenge |
scope | string | no | Used for password sign-in. Defaults to the standard scope |
Example
json
{
"app_client_id": "app-client",
"redirect_uri": "https://example.com/callback",
"code": "authorization-code",
"code_verifier": "verifier-value-with-enough-length-1234567890"
}cURL
bash
curl --request POST 'https://[BASE_URL]/fieldservicegateway/usermanagement/v3/oauth/login/authorize' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {{x-api-key}}' \
--header 'Authorization: {{Authorization}}' \
--header 'Asurion-correlationid: correlation-id' \
--header 'Asurion-enduser: end-user' \
--header 'Asurion-sourcesystem: source-system' \
--header 'Asurion-serviceprovider: company-id' \
--header 'Asurion-client: default' \
--data '{
"app_client_id": "app-client",
"redirect_uri": "https://example.com/callback",
"code": "authorization-code",
"code_verifier": "verifier-value-with-enough-length-1234567890"
}'Response
200 OK
json
{
"success": true,
"data": {
"tokens": {
"access_token": "access-token",
"refresh_token": "refresh-token",
"id_token": "id-token",
"expires_in": 3600,
"token_type": "bearer",
"scope": "openid profile email"
},
"userContext": {
"userFirstname": "Ada",
"userLastname": "Lovelace",
"userName": "user@example.com",
"userEmail": "user@example.com",
"userNumber": "1001",
"sbUsername": ""
}
}
}| Field | Type | Description |
|---|---|---|
tokens.access_token | string | Token for later calls |
tokens.refresh_token | string | Present when a refresh token was issued |
tokens.id_token | string | Present when an id token was issued |
tokens.expires_in | number | Seconds until the access token expires |
tokens.token_type | string | Usually bearer |
userContext | object | Name, email, user number, and ServiceBench username |
Errors
| Status | Code | When |
|---|---|---|
| 400 | VALIDATION_ERROR | Neither code nor username and password was sent |
| 401 | The code, username, or password is not valid | |
| 500 | INTERNAL_ERROR | Something unexpected failed |