My Products
Help
RMaarssen
CONTRIBUTOR *

refresh oauth token

by RMaarssen (Updated ‎21-09-2020 08:12 by Magnus Johnsen VISMA )

After receiving an token using:

https://community.visma.com/t5/Knowledge-base-in-Developers/OAuth-2-0-Authorization-Flow/ta-p/270859

 

i.e.

https://integration.visma.net/API/resources/oauth/authorize?client_id=xxxxxx&redirect_uri=https%3A%2...

 

and then

 

code=a6d426fd-9bd6-4af8-bf33-6b6751a46c89&client_id=xxxxx&client_secret=yyyyyy

&redirect_uri=https://Vismanet.xxxxx.nl&scope=financialstasks&grant_type=authorization_code

 

{"token":"xxxxxxxxxxxxxxxxxxxxx","token_type":"bearer","scope":"financialstasks"}

 

somewhere along testing (after 1 hour i guess) it becomes invalid.

How can we refresh the token ?

 

Thanks.

11 REPLIES 11

by Magnus Johnsen

HI,

 

Please don't share your tokens.

The Visma.Net FInancials API's do not use refresh tokens as they do not expire unless you have requested a new one.

If you have several people using the same user account/client ID combination, you should be sharing the same token.

What error message are you receiving?

kashyap
PARTNER

by kashyap

Hi Magnus,

Do this apply to new connect feature as well?  I have one user which have 18 companies in my system. All are connected using new connect auth feature. Currently getting "invalid_grant" on different companies on different time. Sometimes work and sometimes not work.   How can I make all 18 work at same time?

by Oliver O´Kane

Hi, no this doess not apply to connect. 
Please check this post out: https://community.visma.com/t5/Forum-in-Developers-Visma-net/Visma-net-ERP-API-Developer-Portal-Star... 
This explains the main differences. 
You can also find more info in developer portal here: 

OliverOKane_0-1719905208244.png

 

kashyap
PARTNER

by kashyap

So then there is a issue. We are getting "invalid_grant" when we try to run process for multiple companies at same time. 

FYI: Out of 18 companies 10 companies use the same branch of visma and other 5 & 3 uses different branch of visma.



by Sandra Anté

Hi,

Since this is a thread with issues from both the old authentication method and the new method over a couple of years, we recommend that you start a new thread with a description of the current issues you are experiencing. You can also reach out to your local support here:
https://community.visma.com/t5/Forum-in-Developers-Visma-net/Update-on-Visma-net-ERP-API-Support-cha...

Kind regards
Sandra

kashyap
PARTNER

by kashyap

I have an account with multiple companies exists. Is refresh token same for all companies? 

by Magnus Johnsen

The token you get from the token endpoint is based on your API client ID & Secret + user.

The user is then connected to companies, which would all use the same token.

 

RMaarssen
CONTRIBUTOR *

by RMaarssen

Hi,

 

I was testing with the development of our software.

I am requesting at 2 locations, our software and Postman.

So as i guess, only one of them will keep on working ?

 

Accepted solution
Magnus Johnsen
VISMA

by Magnus Johnsen

Hi,

Indeed, if you request a token again, the last one will get invalidated.

If you save it when you request it, you can use the same token in both places. 

RMaarssen
CONTRIBUTOR *

by RMaarssen

Hi,

 

Well the problem is that we have desktop software, and we want to show our software at different locations.

So i need to build in the token at one location.

The token is connected to "client_id" + "useraccount logged in with at validation" i guess ?

by Yıldırım (Updated ‎21-09-2020 09:49 by Yıldırım VISMA )

Hello, 


@RMaarssen wrote:

The token is connected to "client_id" + "useraccount logged in with at validation" i guess ?


That's true.

For more information, please review the following article regarding Client & Token mechanism.
Background Information on API Client & Token & Visma.net Financials User & Company