Authentication: Direct Login
Direct Login is a simple authentication process for trusted environments and testing.
Step 1: Get your Consumer Key
Read the registration instructions at https://obp-portal-sandbox.nmbbank.co.tz/developers/consumer-creation, log in and proceed to https://obp-portal-sandbox.nmbbank.co.tz/consumers/register to register your application and obtain a consumer_key.
Step 2: Obtain a token
Send a POST request with your credentials in the DirectLogin header:
POST https://obp-api-sandbox.nmbbank.co.tz/obp/v6.0.0/my/logins/direct
Content-Type: application/json
DirectLogin: username=YOUR_USERNAME, password=YOUR_PASSWORD, consumer_key=YOUR_CONSUMER_KEY
The body should be left empty.
A successful response returns a JSON object containing a token:
{"token": "your-token-string"}
Step 3: Use the token in subsequent API calls
Include the token in the DirectLogin header on all subsequent requests:
GET https://obp-api-sandbox.nmbbank.co.tz/obp/v7.0.0/my/banks
DirectLogin: token=your-token-string
Parameters
Parameter names and values are case sensitive. Each parameter must appear only once per request.
- username - The name of the user to authenticate.
- password - The password of the user.
- consumer_key - The application identifier obtained during registration.
Notes
- The header name is DirectLogin (case insensitive for HTTP/1.1, must be lower case for HTTP/2).
- Direct Login is intended for hackathons, testing, and trusted environments.
- For production use with third-party applications, use OAuth2 / OIDC instead.