From 43a597b946645da558b1670a4a893e0a408a2cda Mon Sep 17 00:00:00 2001 From: abisalehalliprasan <38014312+abisalehalliprasan@users.noreply.github.com> Date: Thu, 9 Jul 2020 18:02:25 -0700 Subject: [PATCH] Adding support for custom authorize Endpoints (#92) * Adding support for custom Authorize Endpoints * Passing custom revokeEndpoint, userInfoEndpoint * Bump new version 3.0.2 * Bump new version 3.0.2 --- package.json | 2 +- src/OAuthClient.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 250d44bf..239c74a4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "intuit-oauth", - "version": "3.0.1", + "version": "3.0.2", "description": "Intuit Node.js client for OAuth2.0 and OpenIDConnect", "main": "./src/OAuthClient.js", "scripts": { diff --git a/src/OAuthClient.js b/src/OAuthClient.js index f18c4e19..011c251b 100644 --- a/src/OAuthClient.js +++ b/src/OAuthClient.js @@ -108,6 +108,21 @@ OAuthClient.user_agent = `Intuit-OAuthClient-JS_${ version.version }_${os.type()}_${os.release()}_${os.platform()}`; +OAuthClient.prototype.setAuthorizeURLs = function setAuthorizeURLs(params) { + // check if the customURL's are passed correctly + if (!params) { + throw new Error("Provide the custom authorize URL's"); + } + OAuthClient.authorizeEndpoint = params.authorizeEndpoint; + OAuthClient.tokenEndpoint = params.tokenEndpoint; + OAuthClient.revokeEndpoint = params.revokeEndpoint; + this.environment === 'sandbox' + ? (OAuthClient.userinfo_endpoint_sandbox = params.userInfoEndpoint) + : (OAuthClient.userinfo_endpoint_production = params.userInfoEndpoint); + + return this; +}; + /** * Redirect User to Authorization Page * *