My Products
Help

Generating token with oAuth2 for Visma.Net API in Postman

28-01-2020 15:28 (Updated 23-05-2021)
  • 0 Replies
  • 1 kudos
  • 7722 Views

Manage environments

Creating a new environment

You can create a new environment from the:

  • Manage Environments icon
  • New button
  • Launch screen

Manage environments icon

Click "Manage Environments" icon in the upper right corner of the Postman app.

postman1.png
  • Select “Manage Environments”.
  • Click the Add button.

New button

In the header toolbar, click the New button or click the “Gear” Manage Environments icon

 

Click "Environment" and enter a name for the new environment.

 

Add the variables you want to save as key-value pairs.

 

Click the Add/Update button.

Manage Environments to change the values with your own

 

  • base_uri:currently pointing to API environment <https://integration.visma.net/API>
  • client_id: The client identifier given to the client during the Application registration process.
  • client_secret: The client secret given to the client during the Application registration process.
  • redirect_uri: (CallbackURL)The Application’s callback URL that’s registered with the server. If not provided, Postman uses a default empty URL and extracts the code or access token from it.
  • company_id: Financials companyId that will be used on API calls

 

  • scope:The scope of the access request {financialstasks}
  • state: An opaque value that prevents cross-site request forgery

 

postman2.png

 

oAuth2

OAuth 2.0 is an authorization type that enables you to approve an application that contacts another application for you without exposing your password.


To use the OAuth 2.0 authorization in Postman


  • In the Authorization tab, select "OAuth 2.0" from the TYPE drop down menu.
  • From the "Add authorization data to" drop down menu, select either "Request URL" or "Request Headers".
  • To set the authorization parameters for a request, you have three options:

    • Click the Get New Access Token button. The screen appears. 

Enter the appropriate values, click the Request Token button to populate the "Access Token" field, and then click the Send button.

    • In the "Access Token" field, enter a token, or an environment defined variable, and click the Send button.
    • In the "Available Tokens" drop down menu, select an existing token and click the Send button.

 

postman3.png

 

Get New Access Token

After clicking the Get New Access Token button , Postman brings the following screen where user should fill out the parameters.

 
postman4.png

 

The values used here are the variables defined in the environment. After filling the parameters user needs to click Request Token button.

 

You will be directed to a Visma.net login, enter your credentials and sign in.

 
abc128.png

 

Allow Visma.net Integrations to connect to your account.

 
abc127.png

 

After you click the Allow button and if entered data is correct, you will see the Postman window that has the token.

By default Postman expects to find a field named: access_token in the response. Since the Visma.Net response contains a field named  token , instead of access_token, Postman cannot auto-detect it as an access_token

 

postman5.png

 

Copy the value of token , close the MANAGE ACCESS TOKENS screen and paste it in the Access Token field.

 

postman6.png

 

 

We also recommend taking a look at :
Connecting your Visma.Net Financials company to the API

OAuth 2.0 Authorization Flow