From be252f599fa8b72cc7b63d013db43b24a5c336f9 Mon Sep 17 00:00:00 2001 From: sofisl <55454395+sofisl@users.noreply.github.com> Date: Tue, 4 Apr 2023 13:59:51 -0700 Subject: [PATCH] build: add typings for additional query params for auth (#1534) * build: initial implementation of additional query params for auth --------- Co-authored-by: Daniel Bankhead --- src/auth/oauth2client.ts | 8 ++++++++ test/test.oauth2.ts | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/auth/oauth2client.ts b/src/auth/oauth2client.ts index 45bfe80f..a365277a 100644 --- a/src/auth/oauth2client.ts +++ b/src/auth/oauth2client.ts @@ -296,6 +296,14 @@ export interface GenerateAuthUrlOpts { * must be used with the 'code_challenge' parameter described above. */ code_challenge?: string; + + /** + * A way for developers and/or the auth team to provide a set of key value + * pairs to be added as query parameters to the authorization url. + */ + [ + key: string + ]: querystring.ParsedUrlQueryInput[keyof querystring.ParsedUrlQueryInput]; } export interface AccessTokenResponse { diff --git a/test/test.oauth2.ts b/test/test.oauth2.ts index 8152d011..a4946df9 100644 --- a/test/test.oauth2.ts +++ b/test/test.oauth2.ts @@ -74,6 +74,8 @@ describe('oauth2', () => { access_type: ACCESS_TYPE, scope: SCOPE, response_type: 'code token', + random: 'thing', + another: 'random_thing', }; const oauth2client = new OAuth2Client({ @@ -89,6 +91,8 @@ describe('oauth2', () => { assert.strictEqual(query.get('scope'), SCOPE); assert.strictEqual(query.get('client_id'), CLIENT_ID); assert.strictEqual(query.get('redirect_uri'), REDIRECT_URI); + assert.strictEqual(query.get('random'), 'thing'); + assert.strictEqual(query.get('another'), 'random_thing'); done(); });