Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
Remove state from query string (added by github.dev)
Browse files Browse the repository at this point in the history
  • Loading branch information
znck authored Feb 2, 2023
1 parent c3e538d commit 4c0ca31
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions extension/src/GrammarlyClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,11 @@ export class GrammarlyClient implements Registerable {
}),
window.registerUriHandler({
handleUri: async (uri) => {
if (uri.path === '/auth/callback') {
const url = new URL(uri.toString(true))
if (url.path === '/auth/callback') {
try {
await this.client.protocol.handleOAuthCallbackUri(uri.toString(true))
url.searchParams.delete('state') // added by github.dev
await this.client.protocol.handleOAuthCallbackUri(url.toString())
} catch (error) {
await window.showErrorMessage((error as Error).message)
return
Expand All @@ -137,7 +139,7 @@ export class GrammarlyClient implements Registerable {
await window.showInformationMessage('Account connected.')
}
} else {
throw new Error(`Unexpected URI: ${uri.toString()}`)
throw new Error(`Unexpected URI: ${url.toString()}`)
}
},
}),
Expand Down

0 comments on commit 4c0ca31

Please sign in to comment.