OAuth 2.0 and OpenID connect basics
An OAuth 2.0 or OpenID Connect exchange can involve four roles.
Resource Owner (End-user)
│
│ Delegates
▼
Client (App)
│
├── Obtains token ──▶ Authorization Server (Apaleo Identity API)
│
└── Uses token ─────▶ Resource Server (api.apaleo.com, integration.apaleo.com, etc.)
| OAuth terms | Description |
|---|---|
| Resource owner (End-user) | An entity that owns the data and can grant access to a protected resource. A person in this role is called an end-user. In Apaleo, only an account admin can connect a scope-based app. Any user who holds the permissions the app requests can connect a fine-grained user app. Any user with app:account-level-connected-apps.manage can install an org-level app. The installer’s role ends there, and subsequent access tokens are tied to the account. |
| Client (App) | An application making protected resource requests on behalf of the resource owner and with its authorization. |
| Authorization server (Apaleo Identity API) | The server that validates the authorization grant and issues access tokens to the client. It authenticates users in flows that require user authentication. |
| Resource server (Apaleo Resource APIs) | The server hosting the protected resources, capable of accepting and responding to protected resource requests using access tokens. It trusts the authorization server to authenticate and authorize the OAuth client securely. |
Apaleo Identity API endpoints
| Endpoint | Description |
|---|---|
https://identity.apaleo.com/connect/authorize |
A client app may send a request to this endpoint to receive authorization to access a resource owner’s data residing on a resource server. This action initializes an OAuth flow. |
https://identity.apaleo.com/connect/token |
Post an OAuth 2.0 grant (authorization code, refresh token, client credentials, or installation) to obtain an access token. For user apps, the endpoint can also return an ID token. |
https://identity.apaleo.com/api/v0-nsfw/installations/{installationId}/token |
Exchange client credentials for a token for a specific org-level app installation. The endpoint returns the installation token once. Calling it again rotates the token. |
https://identity.apaleo.com/connect/introspect |
Validate an access token and retrieve its underlying authorization (for resource servers). |
https://identity.apaleo.com/connect/revocation |
Revokes access or refresh token. This endpoint is only applicable to the authorization code grant flow. |
https://identity.apaleo.com/connect/endsession |
To use the end session endpoint, a client application will redirect the user’s browser to the end session URL. |
https://identity.apaleo.com/connect/deviceauthorization |
Can be used to request device and user codes. |
For a fine-grained client, the
scopereturned by the token endpoint contains the marker scopeidentity:permissions. For user apps, it also contains any granted OpenID Connect scopes (openid,profile,offline_access). Access tokens for org-level apps omit OpenID Connect scopes and thesubclaim. The APIs check the app’s permissions on every request. See Scopes and permissions.
Following endpoints are provided to support OpenID Connect:
| Endpoint | Description |
|---|---|
https://identity.apaleo.com/connect/userinfo |
Retrieve profile information and other attributes for a logged-in end-user. |
https://identity.apaleo.com/connect/checksession |
Poll the OpenID provider for changes in end-user authentication status. |
https://identity.apaleo.com/.well-known/openid-configuration/jwks |
Retrieve the public server JSON Web Key (JWK) to verify the signature of issued tokens or to encrypt request objects to the server. |
https://identity.apaleo.com/.well-known/openid-configuration |
Discover the OAuth 2.0 / OpenID Connect endpoints, capabilities, supported cryptographic algorithms, and features. It can be used to configure applications. |
For more information on OAuth 2.0 endpoints, see RFC 6749 and RFC 7009.
Discovery document
The discovery document (also known as “well-known endpoint”) is a set of OpenID Connect values that can be retrieved by OIDC clients. It enables OIDC clients to automatically configure themselves. The Discovery document for Apaleo’s OpenID Connect service can be retrieved from:
https://identity.apaleo.com/.well-known/openid-configuration
To use Apaleo’s OpenID Connect services, you should hard-code the Discovery-document URI (https://identity.apaleo.com/.well-known/openid-configuration) into your application. Your application will fetch the document and retrieve endpoint URIs from it as required. For example, to authenticate a user, your code would retrieve the authorization_endpoint metadata value (https://identity.apaleo.com/connect/authorize) as the base URI for authentication requests that are sent to apaleo.
You can access the discovery document page simply by entering the URL for the well-known endpoint or by using an API call to return discovery document values in JSON format.
For example, here’s a Curl command for returning the discovery document:
curl -XGET -H "Content-type: application/json" 'https://identity.apaleo.com/.well-known/openid-configuration'
Regardless of the method you choose, here’s the sort of information you’ll get back in return:
{
"issuer":"https://identity.apaleo.com",
"jwks_uri":"https://identity.apaleo.com/.well-known/openid-configuration/jwks",
"authorization_endpoint":"https://identity.apaleo.com/connect/authorize",
"token_endpoint":"https://identity.apaleo.com/connect/token",
"userinfo_endpoint":"https://identity.apaleo.com/connect/userinfo",
"end_session_endpoint":"https://identity.apaleo.com/connect/endsession",
"check_session_iframe":"https://identity.apaleo.com/connect/checksession",
"revocation_endpoint":"https://identity.apaleo.com/connect/revocation",
"introspection_endpoint":"https://identity.apaleo.com/connect/introspect",
"device_authorization_endpoint":"https://identity.apaleo.com/connect/deviceauthorization",
"frontchannel_logout_supported":true,
"frontchannel_logout_session_supported":true,
"backchannel_logout_supported":true,
"backchannel_logout_session_supported":true,
"scopes_supported":[
"openid",
"profile",
"transactional-data.delete",
"reservations.import",
....................
"offline_access"
],
...............
}
scopes_supported lists the scopes that scope clients can request. For fine-grained clients, API access is defined by permissions, which they don’t request in scope.