OAuth
Last updated
Was this helpful?
Last updated
Was this helpful?
The permissions OAuth allows are the following:
read and create Monetary Accounts;
read Payments & Transactions;
create Payments between Monetary Accounts of the same user;
create Draft-Payments (the user will need to approve the payment using the bunq app);
assign a Monetary account to a Card;
read, create and manage Cards;
read and create Request-Inquiries
read Request-Responses.
To initiate authorization into the bunq user accounts, you need to create an OAuth Client and register at least 1 redirect URL for it.
The list of steps below will help you to get started:
Add one or more redirect URLs.
If the user accepts the authorization request, they will be redirected to the previously specified redirect_uri
with an authorization code
parameter.
Your web or mobile app must redirect users https://oauth.bunq.com/auth
using the following parameters:
response_type
- bunq supports the authorization code grant. Provide code
as a parameter (required);
client_id
- your Client ID that you can get from the bunq app (required);
redirect_uri
- the URL you wish the user to be redirected to after the authorization is complete (required);
state
- a unique string to be passed back upon completion (optional).
Usehttps://oauth.sandbox.bunq.com/auth
in the sandbox environment.
If the authorization request is accepted by the user, you get the authorization code
. Exchange it for an access_token
.
Make a POST
call to https://api.oauth.bunq.com/v1/token
. Pass the following parameters as GET
variables:
grant_type
- the grant type used, use authorization_code
for now (required)
code
- the authorization Code you received after the authorization request was accepted (required)
redirect_uri
- the same redirect URL you used with the authorization request (required)
client_id
- your Client ID (required)
client_secret
- your Client Secret (required)
Usehttps://api-oauth.sandbox.bunq.com/v1/token
in the sandbox environment.
Token request example:
Example of a successful response:
Example of an error response:
When connecting to a bunq user's account using OAuth, you create a new user (userApiKey
) that has its own id
and access_token
. When sending a request on behalf of a user connected to your app via OAuth, use the id
of userApiKey
as userId
and the item id
s of the bunq user (grantedByUser
).
Example of a successful request URL:
When calling GET /user/{userID},
you will expect to get UserPerson
or UserCompany
. Instead, you will get the UserApiKey
object, which contains references to both the user that requested access (you) and the user that granted access (the bunq user account that your app is connected to).
Ready to connect to bunq users to your application? Do it with a Connect to bunq button. Feel free to use our style guide and prebuilt design assets.
Register an OAuth Client by creating an app in .
Get your client_id
and secret
from your app information tab in .
Redirect your users to the .
Use the to exchange the authorization code
for an access_token
.
Use the access_token
as a normal API Key. Open a session or use to get started.
The access_token
you've received can be used as a normal API key. Use it to with the user account.