forked from n8n-io/n8n
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): Add PKCE for OAuth2 (n8n-io#6324)
* Remove authorization header when empty * Import pkce * Add OAuth2 with new grant type to Twitter * Add pkce logic auto assign authorization code if pkce not defined * Add pkce to ui and interfaces * Fix scopes for Oauth2 twitter * Deubg + pass it through header * Add debug console, add airtable cred * Remove all console.logs, make PKCE in th body only when it exists * Remove invalid character ~ * Remove more console.logs * remove body inside query * Remove useless grantype check * Hide oauth2 twitter waiting for overhaul * Remove redundant header removal * Remove more console.logs * Add comment for code verifier * Remove uneeded scopes * Restore client id in callback * Revert "Add OAuth2 with new grant type to Twitter" This reverts commit 1c3b331. * Remove oauth2 from twitter * Remove properties linked to oauth2 * Fix lodash imports * remove redundant check * remove redundant codeVerifier * patch pkce-challenge to avoid generating `code_verifier` with `~` * store `codeVerifier` on the DB like `csrfSecret` * remove unrelated changes --------- Co-authored-by: Marcus <[email protected]> Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <[email protected]>
- Loading branch information
1 parent
4b0e0b7
commit fc7261a
Showing
12 changed files
with
130 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,7 +94,8 @@ | |
"patchedDependencies": { | ||
"[email protected]": "patches/[email protected]", | ||
"[email protected]": "patches/[email protected]", | ||
"@sentry/[email protected]": "patches/@[email protected]" | ||
"@sentry/[email protected]": "patches/@[email protected]", | ||
"[email protected]": "patches/[email protected]" | ||
} | ||
} | ||
} |
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
52 changes: 52 additions & 0 deletions
52
packages/nodes-base/credentials/AirtableOAuth2Api.credentials.ts
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,52 @@ | ||
import type { ICredentialType, INodeProperties } from 'n8n-workflow'; | ||
|
||
const scopes = ['schema.bases:read', 'data.records:read', 'data.records:write']; | ||
|
||
export class AirtableOAuth2Api implements ICredentialType { | ||
name = 'airtableOAuth2Api'; | ||
|
||
extends = ['oAuth2Api']; | ||
|
||
displayName = 'Airtable OAuth2 API'; | ||
|
||
documentationUrl = 'airtable'; | ||
|
||
properties: INodeProperties[] = [ | ||
{ | ||
displayName: 'Grant Type', | ||
name: 'grantType', | ||
type: 'hidden', | ||
default: 'pkce', | ||
}, | ||
{ | ||
displayName: 'Authorization URL', | ||
name: 'authUrl', | ||
type: 'hidden', | ||
default: 'https://airtable.com/oauth2/v1/authorize', | ||
}, | ||
{ | ||
displayName: 'Access Token URL', | ||
name: 'accessTokenUrl', | ||
type: 'hidden', | ||
default: 'https://airtable.com/oauth2/v1/token', | ||
}, | ||
{ | ||
displayName: 'Scope', | ||
name: 'scope', | ||
type: 'hidden', | ||
default: `${scopes.join(' ')}`, | ||
}, | ||
{ | ||
displayName: 'Auth URI Query Parameters', | ||
name: 'authQueryParameters', | ||
type: 'hidden', | ||
default: '', | ||
}, | ||
{ | ||
displayName: 'Authentication', | ||
name: 'authentication', | ||
type: 'hidden', | ||
default: 'header', | ||
}, | ||
]; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/dist/main.js b/dist/main.js | ||
index 86be84f44210b26583e0a7f1732acd8b98a5e701..a2b05be6a45355704fedf43b51a34793580eaf6c 100644 | ||
--- a/dist/main.js | ||
+++ b/dist/main.js | ||
@@ -42,7 +42,7 @@ $parcel$export(module.exports, "verifyChallenge", () => $f5bfd4ce37214f4f$export | ||
* @param size The desired length of the string | ||
* @returns The random string | ||
*/ function $f5bfd4ce37214f4f$var$random(size) { | ||
- const mask = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~"; | ||
+ const mask = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._"; | ||
let result = ""; | ||
const randomUints = $f5bfd4ce37214f4f$var$getRandomValues(size); | ||
for(let i = 0; i < size; i++){ |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.