I am trying to implement refresh token in my application.
I was able to get both the access token and refresh token using Auth0
I am using password-realm since i have different login application in Auth0.
Question:
What i am trying to do is to get a new access token using the refresh token i received previously.
Configuration:
In the API’s i have also enabled “Allow Offline Access”
and in Application settings “Refresh Token Expiration” Absolute Expiration is enabled and set as 604800 seconds.
In “Advance Settings” grant type “refresh_token” is also enabled.
When i execute the above code i am getting an error as “access denied” with the description “Unauthorised”.
Am i missing any configuration?
I made sure the URL is correct since i am using the same to get access token, refresh token is also the once I received when i logged in and client_id is also correct.
I would appreciate it if anybody could help me to fix this issue.
After looking carefully at the code snippet you shared, I noticed that the audience parameter you passed is not an audience defined in your API settings.
Could you please ensure the audience parameter points to an audience identifier of one of your APIs?
And could you please make sure you are also passing the client_secret parameter in the request? This is needed for confidential clients.
I am testing on a different account that is why the audience parameter is wrong.
In the previous i used the parameter found in the API Audience.
As you have suggested i have added client_secret
Note:
I have different API’s and each API connect to different Database connection.
I am building a authentication server where multiple application uses it to login.
For the above code i am getting the following response
It is also important to note that when i tested the above code when i have only one API and one DB connection it is working. I was able to get the new access token.
Are there any other configuration that i have to do when i have multiple API’s and database base connection. Each API has access to only 1 Database connection and i was able to test it by using login service of different API.