-
-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the bug has not already been reported
Fastify version
^5.6.2
Plugin version
^8.1.2
Node.js version
v22.16.0
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
Sequoia 15.6.1
Description
The code to get the code inside the callback url fails.
I refer to this:
const { token } = await this.linkedinOAuth2.getAccessTokenFromAuthorizationCodeFlow(request);
It throws 400 Bad request
Debugging, the following code:
async getToken(params, httpOptions) {
const parameters = GrantTypeParams.forGrantType('authorization_code', this.#config.options, params);
const response = await this.#client.request(this.#config.auth.tokenPath, parameters.toObject(), httpOptions);
return this.createToken(response);
}
does not pass all the required parameters.
Indeed, parameters.toObject() is:
{
code: "..."
grant_type: "authorization_code"
redirect_url: "http://localhost:3000/login/linkedin/callback"
}
but Linkedin requires also client_id and client_secret as documented here
Link to code that reproduces the bug
https://github.com/bitliner/fastify-oauth-bug
Expected Behavior
The request should not fail with 400
Metadata
Metadata
Assignees
Labels
No labels