User Info Preflight

OPTIONS /oauth/v4/{tenantId}/userinfo

Send a preflight request to retrieve user information.

Request

Path Parameters

tenantId

Required *

string

The service tenant ID or app GUID. The tenant ID can be found in the service credentials. You can create a service credential if one does not already exist.

Query Parameters

Response

204 - The request was successful.

Retrieve user information

POST /oauth/v4/{tenantId}/userinfo

Obtain additional user information from the identity provider which was used to authenticate the user. Learn more.

Request

Path Parameters

tenantId

Required *

string

The service tenant ID or app GUID. The tenant ID can be found in the service credentials. You can create a service credential if one does not already exist.

Query Parameters

Response

200 -

400 - The request is incorrect.

401 - The access token is expired, revoked, or malformed.

403 - The scope is insufficient.

500 - Returned in case of internal server error.

Retrieve user information

GET /oauth/v4/{tenantId}/userinfo

Obtain additional user information from the identity provider which was used to authenticate the user. Learn more.

Request

Path Parameters

tenantId

Required *

string

The service tenant ID or app GUID. The tenant ID can be found in the service credentials. You can create a service credential if one does not already exist.

Query Parameters

Response

200 -

400 - The request is incorrect.

401 - The access token is expired, revoked, or malformed.

403 - The scope is insufficient.

500 - Returned in case of internal server error.

Log user activity

POST /oauth/v4/{tenantId}/activity_logging

Log user activity in IBM Cloud Logs

Request

Request Body

The type of logged activity and the user's ID token are specified as a JSON object.

eventName

Required *

string

The event name.

id_token

Required *

string

The identity token.

Path Parameters

tenantId

Required *

string

The service tenant ID or app GUID. The tenant ID can be found in the service credentials. You can create a service credential if one does not already exist.

Query Parameters

Response

204 - The activity was logged.

400 - The request is incorrect.

401 - The access token is expired, revoked, or malformed.

403 - The scope is insufficient.

Register client

POST /oauth/v4/{tenantId}/clients

Register clients on the App ID instance.

Request

Request Body

CSR

Required *

string

The CSR is attached to the client registration request.

Path Parameters

tenantId

Required *

string

The service tenant ID or app GUID. The tenant ID can be found in the service credentials. You can create a service credential if one does not already exist.

Query Parameters

Response

200 - The request was successful.

Authorization

GET /oauth/v4/{tenantId}/authorization

Request App ID authorization. The method will follow one of the flows as set in the `response_type` field in the query parameters. Learn more.

Request

Path Parameters

tenantId

Required *

string

The service tenant ID or app GUID. The tenant ID can be found in the service credentials. You can create a service credential if one does not already exist.

Query Parameters

response_type

Required *

string

The OAuth2 response type.

client_id

Required *

string

The OAuth2 client ID that can be obtained from the service credentials.

redirect_uri

Required *

string

The OAuth2 callback URI that is used for oauth-flows application. The URI will be invoked after successful authentication/authorization, or after the user clicks the login button.

scope

Required *

string

The OAuth2 scope. The scope should be set to `openid`.

state

string

The OAuth2 state. The parameter should be set to a random string which you will be able to validate in subsequent steps.

idp

string

The identity provider name. An enabled IdP name or `appid_anon` for anonymous login. If left empty, the App ID Login Widget is returned with all enabled IdPs.

nonce

string

Optional parameter. If included, the nonce will be returned in the ID token to allow detection of ID token replay attacks by third parties.

appid_access_token

string

Optional parameter. The parameter supplies the previously obtained access token that is used to identify anonymous users.

user_id

string

The Cloud Directory user ID. The user ID is only required when the response-type is `change_password`.

code

string

The random code that is retrieved from the "/generate_code" endpoint. The code is only required when the response-type is `change_details`.

language

string

The Client language in the format as described in RFC5646.

code_challenge

string

The `code_challenge` parameter is required only for the PKCE flow.

code_challenge_method

string

The `code_challenge_method` parameter is required only for the PKCE flow.

Response

200 - If you choose "sign_up" as the response_type, the LoginWidget sign up html form will be retrieved.

302 - 'The user is not authenticated yet or did not grant access permissions. The response will redirect the user to an authorization UI. Upon successful authentication, an HTTP redirect will be returned with the grant code and state query parameters, e.g. http://myApp.com/oauth/callback?code=ABCD&state=1234.

The grant code should be used with the Token endpoint to obtain access and identity tokens. The state parameter equals to the state parameter supplied in the Authorization Endpoint request and can be used as an additional security layer.

In case authentication fails or the user was denied access request one of the below error codes will be returned as error and state query parameters to the callback, e.g. http://myapp.com/oauth/callback?error=invalid_request&state=1234.

Possible error codes are `invalid_request`, `invalid_client`, `unauthorized_client`, `access_denied`, `unsupported_response_type`, `invalid_scope`, `server_error`, `temporarily_unavailable`.'

400 - The redirection URI is missing, invalid or mismatching, or the client indentifier is missing or invalid.

500 - Returned in case of internal server error.

Token preflight

OPTIONS /oauth/v4/{tenantId}/token

Send a preflight request to retrieve App ID tokens.

Request

Path Parameters

tenantId

Required *

string

The service tenant ID or app GUID. The tenant ID can be found in the service credentials. You can create a service credential if one does not already exist.

Query Parameters

Response

204 - The request was successful.

Token

POST /oauth/v4/{tenantId}/token

Retrieve App ID tokens. Learn more.

Request

Request Body

grant_type

Required *

string

The OAuth2 grant type.

redirect_uri

string

The OAuth2 callback URI that is used for oauth-flows application. The URI will be invoked after successful authentication/authorization. This parameter is required when the grant_type is `authorization_code`.

code

string

The OAuth2 grant code. The parameter is required when the grant_type is `authorization_code`.

username

string

The resource owner's username. If grant_type is selected, this parameter is required as well as the `password`.

password

string

The resource owner's password. If grant_type is selected, this parameter is required as well as the `username`.

scope

string

The list contains the different scopes requested by the client. The scopes within the list are separated by whitespace. The scope parameter is relevant only for the grant_type `urn:ietf:params:oauth:grant-type:jwt-bearer` and `password` flows.

appid_access_token

string

Optional parameter. The parameter supplies the previously obtained access token that is used to identify anonymous users. The parameter is relevant only when the grant_type is `password`.

refresh_token

string

The parameter is to issue a new access token when a valid refresh token is in use. It is required when the grant_type is `refresh_token`.

assertion

string

The IdP payload JWS is required when the grant flow is `b>urn:ietf:params:oauth:grant-type:jwt-bearer`. The payload, at a minimum, must contain the `sub`, `exp`, `aud`, and `iss` fields and be signed using the App ID Custom Flow private key.

code_verifier

string

The `code_verifier` parameter is required only for the PKCE flow.

audience

string

Optional parameter. The audience parameter is relevant only when the grant_type is `client_credentials`. Enter the Client ID of the audience application. Only scopes defined for the audience application will be included in the generated token. If audience is not specified, the client ID used to authorize the request will be used.

Path Parameters

tenantId

Required *

string

The service tenant ID or app GUID. The tenant ID can be found in the service credentials. You can create a service credential if one does not already exist.

Query Parameters

nonce

string

Optional parameter. If included, the nonce will be returned in the ID token to allow detection of ID token replay attacks by third parties.

Response

200 -

400 - Parameters are missing, invalid or mismatching.

500 - Returned in case of internal server error.

Revoke refresh token

POST /oauth/v4/{tenantId}/revoke

Revoke a user's refresh token. Learn more.

Request

Request Body

token

Required *

string

The App ID refresh token.

token_type_hint

string

The refresh token hint.

Path Parameters

tenantId

Required *

string

The service tenant ID or app GUID. The tenant ID can be found in the service credentials. You can create a service credential if one does not already exist.

Query Parameters

Response

200 - The request was successful.

400 - Parameters are missing, invalid or mismatching.

401 - The client_id or client_secret is invalid.

500 - Returned in case of internal server error.

Introspect tokens preflight

OPTIONS /oauth/v4/{tenantId}/introspect

Introspect and validate App ID tokens. Learn more.

Request

Request Body

Path Parameters

tenantId

Required *

string

The service tenant ID or app GUID. The tenant ID can be found in the service credentials. You can create a service credential if one does not already exist.

Query Parameters

Response

204 - The request was successful.

Introspect tokens

POST /oauth/v4/{tenantId}/introspect

Introspect and validate App ID tokens. Learn more.

Request

Request Body

Path Parameters

tenantId

Required *

string

The service tenant ID or app GUID. The tenant ID can be found in the service credentials. You can create a service credential if one does not already exist.

Query Parameters

Response

200 -

400 - Parameters are missing, invalid or mismatching.

401 - The client ID, secret, username, or password is invalid.

500 - Returned in case of internal server error.

Public keys retrival

GET /oauth/v4/{tenantId}/publickeys

Obtain public keys array for token signature verification. Learn more.

Request

Path Parameters

tenantId

Required *

string

The service tenant ID or app GUID. The tenant ID can be found in the service credentials. You can create a service credential if one does not already exist.

Query Parameters

Response

200 - The public keys are returned as a JSON object.

400 - The tenant ID is missing or invalid.

404 - The tenant ID is missing or invalid.

500 - Returned in case of internal server error.

Public keys preflight

OPTIONS /oauth/v4/{tenantId}/publickeys

Send a preflight request to obtain public keys.

Request

Path Parameters

tenantId

Required *

string

The service tenant ID or app GUID. The tenant ID can be found in the service credentials. You can create a service credential if one does not already exist.

Query Parameters

Response

204 - The request was successful. The preflight response is returned.

Generate temporary code

GET /oauth/v4/{tenantId}/cloud_directory/generate_code

Obtain a temporary code that should be supplied to the authorization endpoint when response-type is change_details. The code is valid for 15 seconds.

Request

Path Parameters

tenantId

Required *

string

The service tenant ID or app GUID. The tenant ID can be found in the service credentials. You can create a service credential if one does not already exist.

Query Parameters

Response

200 - The temporary code that should be supplied to the authorization endpoint when response-type is change_details is returned. The code is valid for 15 seconds.

400 - Parameters are missing or invalid.

401 - The username or password is invalid.

500 - Returned in case of internal server error.

Discovery

GET /oauth/v4/{tenantId}/.well-known/openid-configuration

Get the discovery endpoint for the OpenID Connect (OIDC) document including supported configuration and endpoints. Learn more.

Request

Path Parameters

tenantId

Required *

string

The service tenant ID or app GUID. The tenant ID can be found in the service credentials. You can create a service credential if one does not already exist.

Query Parameters

Response

200 -

400 -

500 -

Logout a current SSO session

GET /oauth/v4/{tenantId}/cloud_directory/sso/logout

End a current Cloud Directory Single sign-on (SSO) session by logging out a user. Note: This request requires an SSO cookie. This API should be invoked to log out a user by redirecting their browser to this endpoint. Invoking this request in Swagger will show no response if a 302 status would be returned. Learn more. To end all sessions for a user, use the management API.

Request

Path Parameters

tenantId

Required *

string

The service tenant ID or app GUID. The tenant ID can be found in the service credentials. You can create a service credential if one does not already exist.

Query Parameters

client_id

Required *

string

The OAuth2 client ID that can be obtained from the service credentials.

redirect_uri

Required *

string

The SSO logout callback URI. It is invoked after a successful logout.

Response

302 - Upon successful logout an HTTP redirect will be returned. In case the logout fails, one of the error codes will be returned as error to the callback, e.g. http://myapp.com/oauth/logout-callback?flow=sso_logout&error=missing_sso_code.

Possible error codes are `missing_sso_code`, `invalid_client`, `unauthorized_client`, `server_error`, `temporarily_unavailable`.

400 -

500 -