Direct Login
Authenticate directly with username and password.
Direct Login Authentication
Direct Login is the simplest way to authenticate with the OBP API. It is ideal for testing, scripts, and server-to-server communication. You exchange your credentials for a token in a single request.
Prerequisites
- An OBP user account (register here)
- A registered consumer with a
consumer_key(create one here)
Getting a Token
Send a POST request to the Direct Login endpoint with your credentials in the Authorization header:
POST /my/logins/direct
Authorization: DirectLogin username="YOUR_USERNAME",
password="YOUR_PASSWORD",
consumer_key="YOUR_CONSUMER_KEY"Example with curl:
curl -X POST "https://YOUR_OBP_HOST/my/logins/direct" \
-H 'Content-Type: application/json' \
-H 'Authorization: DirectLogin username="bob",password="secret",consumer_key="abc123"'A successful response returns a token:
{
"token": "eyJhbGciOiJIUzI1NiJ9..."
}Alternative: DirectLogin as Header Name
Instead of using the Authorization header, you can use DirectLogin as the header name directly. This avoids conflicts with other authentication mechanisms that
may use the Authorization header:
DirectLogin: username="YOUR_USERNAME",
password="YOUR_PASSWORD",
consumer_key="YOUR_CONSUMER_KEY"And when using the token:
curl -X GET "https://YOUR_OBP_HOST/obp/v6.0.0/my/accounts" \
-H "Content-Type: application/json" \
-H "DirectLogin: token=YOUR_TOKEN"Using the Token
Include the token in the Authorization or DirectLogin header of subsequent API calls:
Using the Authorization header:
curl -X GET "https://YOUR_OBP_HOST/obp/v6.0.0/my/accounts" \
-H "Content-Type: application/json" \
-H "Authorization: DirectLogin token=YOUR_TOKEN"Using the DirectLogin header:
curl -X GET "https://YOUR_OBP_HOST/obp/v6.0.0/my/accounts" \
-H "Content-Type: application/json" \
-H "DirectLogin: token=YOUR_TOKEN"Token Lifetime
Direct Login tokens are long-lived by default but can be configured per OBP instance. You do not need to refresh the token — request a new one when the current one expires.
When to Use Direct Login
| Use case | Recommended method |
|---|---|
| Testing / exploration | Direct Login |
| Server-to-server scripts | Direct Login |
| Third-party app (user grants access) | OAuth2 / OIDC |
| Open Banking / PSD2 flows | OAuth2 / OIDC |
Security Considerations
- Never use Direct Login in client-side (browser) code — your password would be exposed.
- Use environment variables or a secrets manager to store credentials.
- For production applications that act on behalf of other users, use OAuth2 instead.
See the Authentication endpoints in the API Explorer for more details.