This guide will help you configure API Manager II to work with your Open Bank Project (OBP) OAuth server.
- OBP Server: Running on
http://127.0.0.1:9000 - Redis: Running on
localhost:6379 - Node.js: Version 18+ with npm
- OAuth Client Credentials: Already provided
CLIENT_NAME: obp-api-manager-ii
CONSUMER_ID: 7707cbdb-985f-458a-8b87-e9416c44c421
CLIENT_ID: 39fb9d38-cd0e-44e7-9da5-556d0673e40d
CLIENT_SECRET: NJsso0ugXG6sTT3ngDolw6U_Gr3hfdqCHG-0hvaT54I
Your .env file has been automatically configured with:
# OBP API Configuration
PUBLIC_OBP_BASE_URL=http://127.0.0.1:9000
# OAuth Client Configuration (OBP OIDC)
OBP_OAUTH_CLIENT_ID=39fb9d38-cd0e-44e7-9da5-556d0673e40d
OBP_OAUTH_CLIENT_SECRET=NJsso0ugXG6sTT3ngDolw6U_Gr3hfdqCHG-0hvaT54I
# Application Configuration
APP_CALLBACK_URL=http://localhost:3003/login/obp/callback
# Redis Configuration
REDIS_HOST=localhost
REDIS_PORT=6379
# Server Configuration
PORT=3003http://localhost:3003/callback
http://localhost:3003/oauth/callback
http://localhost:3003/login/obp/callback
-
Via OBP Admin Interface (if available):
- Login to your OBP admin dashboard
- Navigate to OAuth clients
- Find client ID:
39fb9d38-cd0e-44e7-9da5-556d0673e40d - Add/update redirect URI:
http://localhost:3004/login/obp/callback
-
Via OBP API (if you have admin access):
curl -X PUT http://127.0.0.1:9000/obp/v5.1.0/management/consumers/CONSUMER_ID \ -H "Authorization: Bearer YOUR_ADMIN_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "redirect_urls": [ "http://localhost:3003/callback", "http://localhost:3003/oauth/callback", "http://localhost:3003/login/obp/callback" ] }'
-
Manual Configuration:
- Contact your OBP administrator to add the redirect URI
- Or update your server configuration files directly if you have access
API Manager II is configured to use these OAuth endpoints:
Authorization: http://127.0.0.1:9000/auth
Token: http://127.0.0.1:9000/token
UserInfo: http://127.0.0.1:9000/userinfo
JWKS: http://127.0.0.1:9000/jwks
Discovery: http://127.0.0.1:9000/.well-known/openid-configuration
The application uses these OAuth endpoints for authentication.
redis-cli ping
# Should return: PONGcurl http://127.0.0.1:9000/health
# Should return: OK or health status# Test authorization endpoint
curl -I http://127.0.0.1:9000/auth
# Test token endpoint
curl -I http://127.0.0.1:9000/token-
Install dependencies (if not already done):
npm install
-
Start the development server:
npm run dev
-
The application should start on:
http://localhost:3003
-
Visit the login page:
http://localhost:3003/login -
Click "Login with Open Bank Project"
-
You should be redirected to:
http://127.0.0.1:9000/auth?client_id=39fb9d38-cd0e-44e7-9da5-556d0673e40d&response_type=code&redirect_uri=http://localhost:3003/login/obp/callback&scope=openid&state=... -
After authentication, you should be redirected back to:
http://localhost:3003/login/obp/callback?code=...&state=... -
Finally, you should be redirected to the dashboard:
http://localhost:3003/
- Cause: Environment variables not loaded or OAuth client initialization failed
- Solution: Check
.envfile exists and restart the server
- Cause: The callback URL is not registered in your OBP OAuth client
- Solution: Add
http://localhost:3003/login/obp/callbackto your OBP client's redirect URIs
- Cause: OAuth providers not initialized (usually Redis or OBP server issues)
- Solution:
- Check Redis:
redis-cli ping - Check OBP server:
curl http://127.0.0.1:9000/health
- Check Redis:
- Solution: Either:
- Stop the process using port 3003:
lsof -ti:3003 | xargs kill -9 - Or update
.envto use a different port and update redirect URIs accordingly
- Stop the process using port 3003:
- Cause: Client credentials incorrect or token endpoint unreachable
- Solution:
- Verify client ID and secret in
.env - Test token endpoint:
curl -I http://127.0.0.1:9000/token
- Verify client ID and secret in
To see detailed OAuth logs, check the browser console and server logs for messages from:
OAuthProviderFactoryOBPLoginOBPLoginCallbackHooksServer
Run the configuration verification script:
node verify-obp-config.cjsThis will test:
- OBP server health
- OAuth endpoints accessibility
- Client configuration validity
- Redis connection
- HTTPS in Production: Use HTTPS URLs for redirect URIs in production
- Environment Variables: Never commit
.envfiles to version control - Client Secret: Keep the client secret secure and rotate it regularly
- Session Security: Configure secure session settings for production
If you encounter issues:
- Check server logs for detailed error messages
- Verify all prerequisites are met
- Test each OAuth endpoint individually
- Check the OBP client configuration matches the redirect URI
- Ensure Redis is accessible and working
- User clicks "Login with Open Bank Project"
- User is redirected to OBP authorization server (
/auth) - User authenticates with their OBP credentials
- OBP redirects back to API Manager II callback (
/login/obp/callback) - API Manager II exchanges authorization code for access token (
/token) - API Manager II fetches user info (
/obp/v5.1.0/users/current) - User session is created and user is redirected to dashboard
The entire process should be seamless once properly configured.