pilcrowOnPaper / arctic

OAuth 2.0 clients for popular providers

Home Page:https://arctic-reddit.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Atlassian refresh token invalid request

brew-jim opened this issue · comments

Hello,

It looks like there may be a bug in the Atlassian provider as the following code:

const newTokens = await atlassian.refreshAccessToken('...');

Produces an error:

OAuth2RequestError: invalid_request at OAuth2Client.sendTokenRequest

Looking into the codebase I think there may be a wrong method call in arctic/dist/providers/atlassian.js

async refreshAccessToken(refreshToken) {
        const result = await this.client.validateAuthorizationCode(refreshToken, {
            authenticateWith: "request_body",
            credentials: this.clientSecret
        });
        // ...
}

Should be:

async refreshAccessToken(refreshToken) {
        const result = await this.client.refreshAccessToken(refreshToken, {
            authenticateWith: "request_body",
            credentials: this.clientSecret
        });
        // ...
}

Many thanks,
Jim