Skip to content

Commit

Permalink
docs: update comment secion
Browse files Browse the repository at this point in the history
  • Loading branch information
arun3528 committed Jan 21, 2025
1 parent 231efd2 commit b7d89d9
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 19 deletions.
52 changes: 37 additions & 15 deletions packages/@webex/plugin-authorization-browser/src/authorization.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,26 @@ const Authorization = WebexPlugin.extend({
return ret;
},

/**
* Kicks off an oauth flow
* @instance
* @memberof AuthorizationBrowser
* @param {Object} options
* @returns {Promise}
*/
/**
* Initiates the OAuth flow for user authentication.
* This function determines the type of OAuth flow to use based on the client type configuration.
* If the client is configured as "confidential", it will initiate the Authorization Code Grant flow;
* otherwise, it will initiate the Implicit Grant flow.
*
* @instance
* @memberof AuthorizationBrowser
* @param {Object} options - The options to configure the OAuth flow.
* @param {Object} [options.state] - An optional state object that can be used to include additional
* information such as security tokens. A CSRF token will be automatically generated and added to
* this state object.
* @param {boolean|Object} [options.separateWindow] - Determines if the login should open in a separate window.
* This can be a boolean or an object specifying window features:
* - If `true`, a new window with default dimensions is opened.
* - If an object, custom window features can be specified (e.g., `{width: 800, height: 600}`).
* @returns {Promise<void>} - A promise that resolves when the appropriate OAuth flow has been initiated.
* The promise does not necessarily indicate the completion of the login process.
* @throws {Error} - Throws an error if there are issues initiating the OAuth flow.
*/
initiateLogin(options = {}) {
options.state = options.state || {};
options.state.csrf_token = this._generateSecurityToken();
Expand All @@ -134,14 +147,23 @@ const Authorization = WebexPlugin.extend({
},

@whileInFlight('isAuthorizing')
/**
* Kicks off the Authorization Code grant flow. Typically called via
* {@link AuthorizationBrowser#initiateLogin}
* @instance
* @memberof AuthorizationBrowser
* @param {Object} options
* @returns {Promise}
*/
/**
* Initiates the Implicit Grant flow for authorization.
* This function constructs the login URL and either opens it in a new
* window or in the current window based on the provided options.
* Typically called via {@link AuthorizationBrowser#initiateLogin}.
*
* @instance
* @memberof AuthorizationBrowser
* @param {Object} options - The options to configure the login flow.
* @param {Object} [options.separateWindow] - Determines if the login should open in a separate window.
* This can be a boolean or an object specifying window features:
* - If `true`, a new window with default dimensions is opened.
* - If an object, custom window features can be specified (e.g., `{width: 800, height: 600}`).
* @returns {Promise<void>} - A promise that resolves immediately after initiating the login flow.
* This promise does not indicate the completion of the login process.
* @throws {Error} - Throws an error if the login URL cannot be constructed or if window opening fails.
*/
initiateImplicitGrant(options) {

this.logger.info('authorization: initiating implicit grant flow');
Expand Down
15 changes: 11 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12217,10 +12217,17 @@ __metadata:
languageName: node
linkType: hard

"caniuse-lite@npm:^1.0.30001541, caniuse-lite@npm:^1.0.30001587":
version: 1.0.30001692
resolution: "caniuse-lite@npm:1.0.30001692"
checksum: 484113e3fabbe223fff0380c25c861da265a34c3f75bb5af1f254423b43e713a3c7f0c313167df52fb203f42ea68bd0df8a9e73642becfe1e9fa5734b5fc55a5
"caniuse-lite@npm:^1.0.30001541":
version: 1.0.30001565
resolution: "caniuse-lite@npm:1.0.30001565"
checksum: 7621f358d0e1158557430a111ca5506008ae0b2c796039ef53aeebf4e2ba15e5241cb89def21ea3a633b6a609273085835b44a522165d871fa44067cdf29cccd
languageName: node
linkType: hard

"caniuse-lite@npm:^1.0.30001587":
version: 1.0.30001612
resolution: "caniuse-lite@npm:1.0.30001612"
checksum: 2b6ab6a19c72bdf8dccac824944e828a2a1fae52c6dfeb2d64ccecfd60d0466d2e5a392e996da2150d92850188a5034666dceed34a38d978177f6934e0bf106d
languageName: node
linkType: hard

Expand Down

0 comments on commit b7d89d9

Please sign in to comment.