How to refresh a token expired?


Hi all,
I’m using to make client for Oauth2.

I’m trying to refresh expired token with request:
{ json: true, headers: { Authorization: 'Basic YWlydmVydC1vYXV0aDItY29kZS1jbGllbnQ6YWlydmVydE9hdXRoMkNvZGVDbGllbnRTZWNyZXQ=', 'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8' }, payload:'redirect_uri=http%3A%2F%2Flocalhost%3A3001%2Fcallback&scope=openid%2Coffline&grant_type=refresh_token&refresh_token=<refresh token>' }

But after request, I received response with content: Response Error: 400 Bad Request - Make sure that the various parameters are correct, be aware of case sensitivity and trim your parameters. Make sure that the client you are using has exactly whitelisted the redirect_uri you specified.

So how can I fix it?

Thanks so much.

  1. Use the built in function:
  2. Make sure you’ve requested and granted the offline scope