Error Invalid grant: refresh token is invalid in getRefreshToken

时间:2019-05-31 11:50:26

标签: node.js model grant oauth2-server

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 个答案:

答案 0 :(得分:0)

根据docs,您应将{ "id" : 101, "timestamp" : "utc(12/05/2019:T)", "readings" : [ { "bod" : 12, "cod" : 25, "cod" : 16, "flow" : 45, }, { "bod" : 2, "cod" : 2, "cod" : 17, "flow" : 25, } ] } 更改为

client: 'client1',