Skip to content

Error revoking token, this.token.refreshToken is not a function #16

@jt274

Description

@jt274

I've already retrieved tokens and am able to successfully communicate with the API using them. The tokens are stored in a database. I am unable to call the revoke function to revoke the tokens though, as I get the following error: TypeError: this.token.refreshToken is not a function

The tokens are retrieved from the database and the token revoke code is:

oauthClient.revoke()
.then((authResponse) => {
console.log('Token revoked: ' + JSON.stringify(authResponse.json()));
}).catch((e) => {
console.error('Error revoking token: ' + e);
});

I am setting the token to the current client instance:

oauthClient.token = {
"token_type": "bearer",
"expires_in": 3600,
"refresh_token": "<refresh_token>",
"x_refresh_token_expires_in": 15552000,
"access_token": "<access_token>"
};

I get the same error if simply passing the refresh token or access token to the revoke function - none of the below work with the token or refresh token:

`oauthClient.revoke({refresh_token})

oauthClient.revoke(refresh_token)

oauthClient.revoke({"token": refresh_token})`

In the library OAuthClient.js line 638 I see:

if(!this.token.refreshToken()) throw new Error('The Refresh token is missing');

Am I passing the wrong info? Strange it says it is not a function. I'm on the latest version 1.1.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions