Skip to content

Commit

Permalink
Adding support for custom authorize Endpoints (#92)
Browse files Browse the repository at this point in the history
* Adding support for custom Authorize Endpoints

* Passing custom revokeEndpoint, userInfoEndpoint

* Bump new version 3.0.2

* Bump new version 3.0.2
  • Loading branch information
abisalehalliprasan authored Jul 10, 2020
1 parent c959ed5 commit 43a597b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
15 changes: 15 additions & 0 deletions src/OAuthClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
* *
Expand Down

0 comments on commit 43a597b

Please sign in to comment.