Login API extended Postman guide
This is a guide for the using the Login API with Postman, and is an extension of the Login API quick start guide which shows the recommended flow in both Postman and curl.
Prerequisites
You must have already signed up as an organization with Vipps MobilePay and have your test credentials from the merchant portal. See Getting started guide.
Your test sales unit must be set up for using login. See How to set up login on your sales unit.
Set up
You will need the following values (How to find the API keys):
client_id
- Client_id for a test sales unit.client_secret
- Client_secret for a test sales unit.Ocp-Apim-Subscription-Key
- Subscription key for a test sales unit.merchantSerialNumber
- The unique ID for a test sales unit.internationalMobileNumber
- The MSISDN for the test app profile you have received or registered. This is your test mobile number including country code.well-known_uri
- URI to well-known endpoint for used environment. See API Guide: well known for more details.redirect_uri
- The URI where the user is sent after finishing a login. The URI must be exactly the same as the one specified in your sale unit. See How to set up login on your sales unit.
🔥 Do not store production keys in the Postman cloud. 🔥
To prevent your sensitive data and credentials from being synced to the Postman cloud, store them in the Current Value fields of your Postman environment.
Open Postman and do the following:
-
Import the following files:
-
Select to use the imported global environment.
-
In the global environment, update only the Current Value field with your own values for the following:
client_id
client_secret
Ocp-Apim-Subscription-Key
merchantSerialNumber
internationalMobileNumber
well-known_uri
redirect_uri
Standard Login API calls
User initiated login from a website
- Send request
Get OIDC well-known
. - In your active Postman environment, copy the value of key
start_login_uri
, and use this URL in any browser. - Finish login. This request includes a scope parameter that requests access to user information. This means that if you have not yet consented to sharing your user information, a distinct screen asking for your consent will appear the first time.
- When you finish your login, the website will update.
If you used
http://localhost
, it will appear to be broken, but that doesn't matter. Copy the query parametercode
from the URL in the browser. Paste this code into the keycode
in the active Postman environment. - From the
Login in Browser
folder, send requestGet token
. This provides the access token and ID token. - Send request
Get user info
to get the user info of the logged-in user.
Merchant initiated login (CIBA without redirect)
- Send request
Get OIDC well-known
. This will populate the environment variablesinit_ciba_endpoint
,token_endpoint
anduserinfo_endpoint
used in subsequent requests. - From the
CIBA Without Redirect
folder, send request toInit CIBA no-redirect
. This will trigger a push message to the Vipps or MobilePay app registered with theinternationalMobileNumber
in your environment. This request will populate the environment variableauth_req_id
used for the subsequent token request. - Authenticate in the Vipps or MobilePay app and approve the login request.
- Send request to
Token no-redirect
endpoint. This will populate the environment variableaccess_token
used for the subsequent request. - Send request to
Get user info
. This will use the token from (4) to obtain the userinfo of the logged-in user.
Merchant initiated login (CIBA with redirect)
- Send request
Get OIDC well-known
. This will populate the environment variablesinit_ciba_endpoint
,token_endpoint
anduserinfo_endpoint
used in subsequent requests - From the
CIBA With Redirect
folder, submit theInit CIBA redirect
. This will trigger a push message to the Vipps or MobilePay app registered with theinternationalMobileNumber
in your environment. - Authenticate in the Vipps or MobilePay app and approve the login request. Your mobile will now open the URL specified by
redirect_uri
(defaulthttp://localhost
) with acode
query parameter after successful authentication. It doesn't matter if the page appears to be broken, you only need thecode
value from the address. - Copy/take note of the
code
parameter in the query string that you were returned to in the above step. This code has 300s time-to-live in test environment and 30s time-to-live in production environment. - Set the value of the
code
parameter in the body of theToken redirect
request to the code you obtained in the previous step. - Submit the
Token redirect
request. This will populate the environment variableaccess_token
used for the subsequent request. - Send request to
Get user info
. This will use the token from the previous step to obtain the user info of the logged-in user.
Partner API calls
Please note: Partner API keys are only functional in the production environment, not the test environment.
As a partner: Set up Postman environment
You will need the following values:
client_id
- Client ID for a production sales unit.client_secret
- Client secret for a production sales unit.well-known_uri
- URL to well-known endpoint for used environment. See API Guide: well known for more details.redirect_uri
- The URL where the user is sent after finishing a login. The URL must be exactly the same as the one specified in your sale unit. See How to set up login on your sales unit.internationalMobileNumber
- The phone number of the user to log in.targetMerchantSerialNumber
- The target merchant you want to log in towards.
As a partner: Login from phone number (CIBA without redirect)
- Send request
Get OIDC well-known
. This will populate the environment variablesinit_ciba_endpoint
,token_endpoint
anduserinfo_endpoint
used in subsequent requests. - Using requests in the folder
Partner login/CIBA without redirect
- Send request
Get partner token
- Send request
Start login
. This will trigger a push message to the Vipps or MobilePay app registered with theinternationalMobileNumber
in your environment. This request will populate the environment variableauth_req_id
used for the subsequent token request. - Authenticate in the Vipps or MobilePay app and approve the login request.
- Send request
Get login token
. This will populate the environment variableaccess_token
used for the subsequent request. - Send request
Get user info
stored in the root folder. This will use the token from (6) to obtain the userinfo of the logged-in user.
As a partner: Login from phone number (CIBA with redirect)
- Send request
Get OIDC well-known
. This will populate the environment variablesinit_ciba_endpoint
,token_endpoint
anduserinfo_endpoint
used in subsequent requests. - Using requests in the folder
Partner login/CIBA with redirect
- Send request
Get partner token
- Send request
Start login
. This will trigger a push message to the Vipps or MobilePay app registered with theinternationalMobileNumber
in your environment. This request will populate the environment variableauth_req_id
used for the subsequent token request. - Authenticate in the Vipps or MobilePay app and approve the login request. Your mobile will now open the URL specified by
redirect_uri
(defaulthttp://localhost
) with acode
query parameter after successful authentication. It doesn't matter if the page appears to be broken, you only need thecode
value from the address. - Copy/take note of the
code
parameter in the query string that you were returned to in the above step. This code has 300s time-to-live in test environment and 30s time-to-live in production environment. - Set the value of the
code
parameter in the body of theGet login token
request to the code you obtained in the previous step. - Send request
Get login token
. This will populate the environment variableaccess_token
used for the subsequent request. - Send request
Get user info
stored in the root folder. This will use the token from (8) to obtain the userinfo of the logged-in user.
See the API reference for details about the calls.