-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(sdk) remove pkce option becuase all OAuth flows must use PKCE
- Loading branch information
Showing
11 changed files
with
92 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import qs from 'qs'; | ||
|
||
export interface UrlExpectation { | ||
baseUrl: string; | ||
path: string; | ||
query?: Record<string, string>; | ||
} | ||
|
||
export default function expectUrlToMatchWithPKCE(actual: URL | string, expectation: UrlExpectation) { | ||
const url = typeof actual === 'string' ? new URL(actual) : actual; | ||
const actualQuery = qs.parse(new URLSearchParams(url.search).toString()); | ||
|
||
expect(actualQuery.code_challenge).toBeDefined(); | ||
delete actualQuery.code_challenge; // ignore PKCE code challenge because it's randomly generated | ||
expect(actualQuery.code_challenge_method).toBe('S256'); | ||
delete actualQuery.code_challenge_method; | ||
|
||
expect(url.pathname).toBe(expectation.path); | ||
expect(`${url.protocol}//${url.hostname}`).toBe(expectation.baseUrl); | ||
expect(actualQuery).toEqual(expectation.query || {}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.