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 * *