Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding support for custom authorize Endpoints #92

Merged
merged 4 commits into from
Jul 10, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/OAuthClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,24 @@ OAuthClient.user_agent = `Intuit-OAuthClient-JS_${
version.version
}_${os.type()}_${os.release()}_${os.platform()}`;

/**
* Helper function for setting custom authorizeEndpoint/tokenEndpoint URL's
* *
* @param params
* @returns {null}
*/
OAuthClient.prototype.setAuthorizeURLs = function setAuthorizeURLs(params) {
params = params || {};

// check if the customURL's are passed correctly
if (!params.authorizeEndpoint || !params.tokenEndpoint)
throw new Error('Provide the custom authorize URL');

OAuthClient.authorizeEndpoint = params.authorizeEndpoint;
OAuthClient.tokenEndpoint = params.tokenEndpoint;
return null;
};

/**
* Redirect User to Authorization Page
* *
Expand Down