OAuth2 / OIDC
OAuth2 and OpenID Connect authentication flows.
OAuth2 and OpenID Connect
OAuth2 is the recommended authentication method for production applications, especially when your app needs to act on behalf of other users. OBP supports the standard OAuth2 Authorization Code flow, and can integrate with OpenID Connect (OIDC) identity providers.
Prerequisites
- A registered consumer with a valid Redirect URL (register here)
- Your
consumer_key(used asclient_id) andconsumer_secret(used asclient_secret)
Authorization Code Flow
Step 1: Redirect the user to authorise
Direct the user's browser to the OBP authorisation endpoint:
GET https://YOUR_OBP_HOST/oauth/authorize?client_id=YOUR_CONSUMER_KEY
&redirect_uri=YOUR_REDIRECT_URL
&response_type=code
&state=RANDOM_STATE_STRINGThe user will log in (if not already) and be asked to grant your application access. After
approval, they are redirected back to your redirect_uri with an authorisation code.
Step 2: Exchange the code for a token
POST https://YOUR_OBP_HOST/oauth/token
Content-Type: application/x-www-form-urlencoded
grant_type=authorization_code
&code=THE_AUTH_CODE
&redirect_uri=YOUR_REDIRECT_URL
&client_id=YOUR_CONSUMER_KEY
&client_secret=YOUR_CONSUMER_SECRETThe response includes an access token:
{
"access_token": "eyJhbGciOiJIUzI1NiJ9...",
"token_type": "bearer",
"expires_in": 3600,
"refresh_token": "..."
}Step 3: Use the access token
curl -X GET "https://YOUR_OBP_HOST/obp/v6.0.0/my/accounts" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"Refreshing Tokens
When the access token expires, use the refresh token to obtain a new one:
POST https://YOUR_OBP_HOST/oauth/token
grant_type=refresh_token
&refresh_token=YOUR_REFRESH_TOKEN
&client_id=YOUR_CONSUMER_KEY
&client_secret=YOUR_CONSUMER_SECRETOpenID Connect (OIDC)
OBP can be configured to use an external OIDC identity provider (e.g. Keycloak, Auth0, Azure AD) for authentication. In this setup:
- The identity provider handles user login and issues ID tokens.
- OBP validates the tokens and creates/maps users internally.
- Your application follows the standard OIDC Authorization Code flow with the identity provider.
Identity providers on this instance
The list comes from GET /obp/v5.1.0/well-known(API Explorer).
Security Best Practices
- Always use the
stateparameter to prevent CSRF attacks. - Store tokens securely — never in localStorage or URLs.
- Use PKCE (Proof Key for Code Exchange) for public clients (SPAs, mobile apps).
- Keep your
client_secreton the server side only. - Request only the scopes your application needs.
Related
- Consents — grant third-party access to accounts
- Consent endpoints in the API Explorer