Error Invalid grant: refresh token is invalid in getRefreshToken

416 views Asked by At

I want to implement the function getRefreshToken with the oauth2-server module in Nodejs. I already implemented the whole password grant type successfull. But now I want to implement the refresh_token grant. I'm facing a problem by implementing the getRefreshToken function in the models.

If I call the refresh_token route with the grant_type: refresh_token and the refresh_token I'm getting back the error message:

"Invalid grant: refresh token is invalid".

I never check if the refreshToken is valid/expired or not. I just want to implement a dummy function which should return me a new accessToken.

What am I doing wrong?

getRefreshToken: (refreshToken, callback) => {
    const token = {
        refreshToken: refreshToken,
        client: 'client1',
        user: 'UserIdXY'
    }

    callback(false, token);
}
1

There are 1 answers

0
barbsan On

According to the docs you should change client: 'client1', to

client: {id: 'client1'},