My Products
Help

How to get a token with postman using Visma Connect Authentication

by Thomas Adrian - Consili (Updated ‎16-03-2023 09:25 by Thomas Adrian - Consili )

 

How to make a request using Postman to get a token using the Visma Connect Authentication.

I have added the tenant to the "Visma Developer Portal - My Application" and everything is approved.

 

see image 

 

ThomasAdrianConsili_0-1678954000057.png

 

17 REPLIES 17

by ReinderReinders

I received error: invalid_client when I accidentally integrated my application with the wrong API in Visma Connect (develop v.s. production). Are you certain you are integrated to the correct Visma.net instance?

by Magnus Johnsen

What type of application have you registered? I'm guessing it's the interactive api, is that correct?

What grants and scopes have you set?

hello,

 

as you can see in the first image I have set create, read and update.

however it is the second image which probably is more correct as I send the data in the post.

 

the problem I have is that the documentation is lacking and confusing. if I look in the sales order documentation there are screenshots for how to get a token using postman and that documentation have other scopes and settings than the visma connect authentication documentation, neither work. I have tried setting different scopes other than what is showed in my screenshot.

 

I am not using the sales order api. I am using the original api, just trying to rewrite my integrations so I can get a token according to your instructions.

 

Not sure what the interactive api is, I have registered an app as an invitee only, not published on appstore.

 

can you please provide a working example of postman request to get a token so I know that i have correct settings in postman

 

 

 

thanks

Thomas

 

 

 

 

 

 

 

Accepted solution
Magnus Johnsen
VISMA

Hi,

Depending on if your integration is setup to be Interactive (A user logs in to your integration and interacts with an UI) or a non-Interactive(service-to-service) the setup is different.

 

For non-interactive:

POST https://connect.visma.com/connect/token

--header: 'content-type: application/x-www-form-urlencoded'

--data: 'grant_type=client_credentials&scope=visma_api:read&client_id=demoapp&client_secret=SECRET&tenant_id=af1140c1-52e0-46c7-b684-df894d4b8a5a'

 

For interactive:

GET https://connect.visma.com/connect/authorize
?client_id=demoapp
&response_type=code+id_token
&response_mode=form_post
&scope=openid+email+profile
&redirect_uri=http://demoapp.example.com/oauthcallback

 

The salesOrder api currently does not use the same tokens, the Visma Connect team is working on a solution for this.

Lindstromer
CONTRIBUTOR **

I'm getting the same kind of error when trying, have tried setting the scope to both:

visma_api:read

and this (matching applications scopes from what I can read/see):

 

visma.net.erp.service.api:create vismanet_erp_service_api:delete vismanet_erp_service_api:read vismanet_erp_service_api:update

 

Still getting:

{
"error": "invalid_scope"
}

 

Any tips? It doesn't work as expected when following the education portal/recert 2022 course, or the documentation that I can find on this matter.

 

Would be good to get it up and running since we're closing in on 1st of June, that was mentioned as a day when the old token generation would be deprecated (is that still the case?).

Hi,

The date that had previously been announced was that the salesOrder v1/v2 were getting deprecated, this is no longer the case, for now, this has been moved to end of Q4 2024.

Regarding the authentication methods, currently there is not date set for when the old authentication will be removed, we are no longer onboarding new ISV's to the old method, but it still works just as before. 

Regarding your issue, what application type have you registered in the developer portal?

Lindstromer
CONTRIBUTOR **

Ah, good to know. Yet still a bit uncertain on the token handling then.  Application is registered as "Visma.net ERP Service API" (vismanet_erp_service_api). 

 

Scope according to customer list is:

 

vismanet_erp_service_api:update, vismanet_erp_service_api:create, vismanet_erp_service_api:read, vismanet_erp_service_api:delete

 

this works for me in postman

ThomasAdrianConsili_0-1684161266409.png

 

by Magnus Johnsen (Updated ‎16-05-2023 13:54 by Magnus Johnsen VISMA )

Then this should work(Do note that the scopes are separeated by a space), in your initial message, the first scope has some punctation in it : 

 

 

vismanet_erp_service_api:update vismanet_erp_service_api:create vismanet_erp_service_api:read vismanet_erp_service_api:delete

 

 

Lindstromer
CONTRIBUTOR **

Thank you, my bad then with the punctuation in the first one. A bit of mixed examples in the tutorials/pdfs. 😀

I had missunderstood the client credentials, 

it is working now

 

Robinkuijs
CONTRIBUTOR **

Could you please let me know the solution? I am getting the same error, but I don't know how to solve it

invalid client.png

by Thomas Adrian - Consili (Updated ‎21-09-2023 14:18 by Thomas Adrian - Consili )

If you still have problems initiate a chat on ms teams and I can try to help out

thomas dot adrian @ consili.se

The last time I received "invalid_client" it was because I was using the wrong Visma Connect URL (staging instead of production). Maybe that helps?

Robinkuijs
CONTRIBUTOR **

by Robinkuijs (Updated ‎20-09-2023 09:30 by Robinkuijs )

Thank you Reinder, this is the url that I'm using:
Schermafbeelding 2023-09-20 092820.png

Schermafbeelding 2023-09-20 092820.png

It doesn't seem that there's a different url for staging or prod

what does the error indicate? is the client id and client secret wrong?

how can I check if my values are correct?


ThomasAdrianConsili_0-1679580075776.png

 

by Thomas Adrian - Consili

I have also this and get another error

 

ThomasAdrianConsili_0-1678956103001.png