Overview
Step 1: Build the authorization URL
Redirect your user to:Parameters
| Parameter | Required | Description |
|---|---|---|
client_id | ✅ | Your app’s client ID |
redirect_uri | ✅ | Must exactly match a registered URI including protocol, path, no trailing slash differences |
scope | ✅ | Space-separated list of scopes you are requesting. See Scopes |
state | Strongly recommended | Random string you generate. Returned unchanged on callback. Validates the request wasn’t tampered with |
Generating state
Always generatestate fresh per request and store it in the user’s session:
Step 2: User approves on Monei
The user lands on Monei’s consent screen. If not logged in to Monei, they are prompted to log in first. The consent screen shows:- Your app name and logo (from registration)
- Every scope you requested, in plain English
- A clear allow / deny choice per scope
wallet:read but deny wallet:send. Your app must handle this. See Partial Grants.
Step 3: Monei redirects back
On approval
code is short-lived, exchange it within 10 minutes or it expires.
On denial
Validating state
Always compare the returnedstate to what you stored before proceeding:
Step 4: Exchange the code for tokens
This must happen server-side. Never expose yourclient_secret in frontend or mobile code.
Response
Implementation
Step 5: Call APIs on behalf of the user
Pass the access token as a Bearer token on every request:403 Forbidden.
Common mistakes
Using an expired code: authorization codes expire in 10 minutes. Exchange them immediately in the callback handler. Skipping state validation: always validate state. Skipping it leaves your users vulnerable to CSRF. Token exchange in the browser: yourclient_secret must never touch the frontend. All token exchange happens on your server.
Assuming all scopes were granted: users can partially approve. Always check the scopes field in the token response.
Not storing the refresh token: access tokens expire in 1 hour. Store the refresh token so you can get a new one without the user re-authorizing.
Token Management
How to refresh, store, and revoke tokens
Partial Grants
Handle users approving fewer scopes than requested

