Skip to content

Commit

Permalink
fix: The token request should not include the scope parameter (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony-vito authored Dec 12, 2023
1 parent fd2cb43 commit 84baba8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ReactNode } from 'react'

interface TTokenRqBase {
grant_type: string
scope?: string
client_id: string
redirect_uri: string
}
Expand All @@ -13,6 +12,7 @@ export interface TTokenRequestWithCodeAndVerifier extends TTokenRqBase {
}

export interface TTokenRequestForRefresh extends TTokenRqBase {
scope?: string
refresh_token: string
}

Expand Down
1 change: 0 additions & 1 deletion src/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ export const fetchTokens = (config: TInternalConfig): Promise<TTokenResponse> =>
const tokenRequest: TTokenRequestWithCodeAndVerifier = {
grant_type: 'authorization_code',
code: authCode,
scope: config.scope,
client_id: config.clientId,
redirect_uri: config.redirectUri,
code_verifier: codeVerifier,
Expand Down
2 changes: 1 addition & 1 deletion tests/get_token.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test('make token request with extra parameters', async () => {

await waitFor(() =>
expect(fetch).toHaveBeenCalledWith('myTokenEndpoint', {
body: 'grant_type=authorization_code&code=1234&scope=someScope%20openid&client_id=anotherClientId&redirect_uri=http%3A%2F%2Flocalhost%2F&code_verifier=arandomstring&testTokenKey=tokenValue',
body: 'grant_type=authorization_code&code=1234&client_id=anotherClientId&redirect_uri=http%3A%2F%2Flocalhost%2F&code_verifier=arandomstring&testTokenKey=tokenValue',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
Expand Down

0 comments on commit 84baba8

Please sign in to comment.