Quick start
Before you begin
Use the Login API to confirm your identity through the log-in process.
This document covers the quick steps for getting started with the Login API. You must have already signed up as an organization with Vipps MobilePay and have your test credentials from the merchant portal, as described in the Getting started guide.
Important: The examples use standard example values that you must change to use your values. This includes API keys, HTTP headers, reference, etc.
Log in with browser
Step 1 - Setup
- curl
- Postman
Please note: Postman is discontinuing their offline version. Use only your test keys and delete them after testing. Ensure that your company allows for cloud use before continuing.
If you wish to use Postman, import the following files:
In Postman, tweak the environment with your own values (see API keys):
client_id
- Merchant key required for getting the access token.client_secret
- Merchant key required for getting the access token.Ocp-Apim-Subscription-Key
- Merchant subscription key.merchantSerialNumber
- Merchant ID.mobileNumber
- The phone number for the test app profile you have received or registered.redirect_uri
- The website to send the user to after they log in. This must be exactly the same as the one specified your sales unit.
No setup needed :)
Step 2 - Get OIDC Well known
- curl
- Postman
Send Get OIDC well-known
curl https://apitest.vipps.no/access-management-1.0/access/.well-known/openid-configuration \
-H "Merchant-Serial-Number: 123456" \
-H "Vipps-System-Name: acme" \
-H "Vipps-System-Version: 3.1.2" \
-H "Vipps-System-Plugin-Name: acme-webshop" \
-H "Vipps-System-Plugin-Version: 4.5.6" \
-X GET
Step 3 - Log in
- curl
- Postman
In your active Postman environment, copy the value of key start_login_uri
and paste it into the address field of any browser.
Put together the URI in this format (OAuth 2.0 Authorize):
https://apitest.vipps.no/access-management-1.0/access/oauth2/auth?client_id=YOUR-CLIENT-ID&response_type=code&scope=openid%20name%20phoneNumber%20address%20birthDate&state=8652682f-ba1d-4719-b1ec-8694ba97bde7&redirect_uri=http://localhost
Paste the URL into the address field of any browser.
Finish the login. If you have not yet consented to sharing your user information, a new screen will be presented in the app requesting your consent.
If you have already completed this process and selected Remember me in browser earlier, this will take you straight to the redirect URL.
Step 4 Get token
On the redirect URL page, copy the code
value out from the address field in the URL.
- curl
- Postman
Paste the code into the key code
in the active Postman environment and then get the token.
Send request Get token
Use the code
in the following command.
You will also need to generate client authorization.
The client credentials is a base64-encoded string consisting of the client_id and secret issued by Vipps.
Example in JavaScript:
var client_id = 123456-test-4a3d-a47c-412136fd0871
var client_secret = testdzlJbUZaM1lqODlnUUtrUHI=
var wordArrayAzp = CryptoJS.enc.Utf8.parse(client_id + ":" + client_secret);
var client_authorization = CryptoJS.enc.Base64.stringify(wordArrayAzp);
curl https://apitest.vipps.no/access-management-1.0/access/oauth2/token \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Authorization: Basic {client credentials}' \
-H "Merchant-Serial-Number: 123456" \
-H "Vipps-System-Name: acme" \
-H "Vipps-System-Version: 3.1.2" \
-H "Vipps-System-Plugin-Name: acme-webshop" \
-H "Vipps-System-Plugin-Version: 4.5.6" \
-X POST \
--data-urlencode 'grant_type=authorization_code' \
--data-urlencode 'code=THE CODE FROM THE URL' \
--data-urlencode 'redirect_uri=http://localhost'
Copy the access token from the response.
Step 5 - (Optional) Get userinfo
Send request Get Userinfo
. This uses GET:/vipps-userinfo-api/userinfo/
.
Use the access token from the previous step.
- curl
- Postman
Send request Get userinfo
curl https://apitest.vipps.no/vipps-userinfo-api/userinfo/ \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1Ni <truncated>" \
-H "Ocp-Apim-Subscription-Key: 0f14ebcab0ec4b29ae0cb90d91b4a84a" \
-H "Merchant-Serial-Number: 123456" \
-H "Vipps-System-Name: acme" \
-H "Vipps-System-Version: 3.1.2" \
-H "Vipps-System-Plugin-Name: acme-webshop" \
-H "Vipps-System-Plugin-Version: 4.5.6" \
-X GET
Next steps
See the Login API guide to read about the concepts and details.
For more examples, see the step-by-step instructions in the Login API Postman guide.