API - create\update token

Hi I have a problem after the first time I create the token
from the guide

after 40 minute the token expire and I need create another or refresh
but I receive a error
{“error”:“invalid_request”,“error_description”:“Incorrect request token”}

if I generate a new “code” (point 3) from
Sign up for Revolut Business&redirect_uri=https://example.com&response_type=code#authorise
work

is possiible?

2 Likes

Hi @Scoccia
When you obtained the first access_token (using the code parameter from the redirection), you also received a refresh_token in the response.

When the access_token expires, you can generate a new one using the refresh_token as described in Refresh the access token

If you didn’t save the refresh_token, then you will need to generate a new one.

3 Likes

thank you Samuel but I do this

curl https://b2b.revolut.com/api/1.0/auth/token \
  -H "Content-Type: application/x-www-form-urlencoded"\
  --data "grant_type=refresh_token"\
  --data "refresh_token=(old_Token)"\
  --data "client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer"\
  --data "client_assertion=(my_JWS)"

but the error is

{"error":"invalid_request","error_description":"Incorrect refresh token"}

2 Likes

Hi @Scoccia
I see you are sending old_Token which I assume is your expired access_token. This is not correct.

As an example, when you called /token the first time during setup, you should have received something like this in the response:

{
    "access_token": "oa_prod_rPo9Om.......",
    "token_type": "bearer",
    "expires_in": 2399,
    "refresh_token": "oa_prod_hQacSG........"
}

Note that there are two tokens, you should use the second one (refresh_token) to obtain a new access_token.

5 Likes

Welcome to our community @Scoccia. I hope Samuel’s reply will help you to resolve your concern. :hugs:

Was this helpful? Let us know.

  • Yes
  • No
0 voters

SG | Community Team

1 Like

Ah ok ok thank you… I missed this step
thank you

2 Likes

Great to hear that your issue got resolved @Scoccia. Keep exploring our community. :star_struck:

SG | Community Team

1 Like