Skip to content

Commit b7d89d9

Browse files
committed
docs: update comment secion
1 parent 231efd2 commit b7d89d9

File tree

2 files changed

+48
-19
lines changed

2 files changed

+48
-19
lines changed

packages/@webex/plugin-authorization-browser/src/authorization.js

+37-15
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,26 @@ const Authorization = WebexPlugin.extend({
113113
return ret;
114114
},
115115

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

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

147169
this.logger.info('authorization: initiating implicit grant flow');

yarn.lock

+11-4
Original file line numberDiff line numberDiff line change
@@ -12217,10 +12217,17 @@ __metadata:
1221712217
languageName: node
1221812218
linkType: hard
1221912219

12220-
"caniuse-lite@npm:^1.0.30001541, caniuse-lite@npm:^1.0.30001587":
12221-
version: 1.0.30001692
12222-
resolution: "caniuse-lite@npm:1.0.30001692"
12223-
checksum: 484113e3fabbe223fff0380c25c861da265a34c3f75bb5af1f254423b43e713a3c7f0c313167df52fb203f42ea68bd0df8a9e73642becfe1e9fa5734b5fc55a5
12220+
"caniuse-lite@npm:^1.0.30001541":
12221+
version: 1.0.30001565
12222+
resolution: "caniuse-lite@npm:1.0.30001565"
12223+
checksum: 7621f358d0e1158557430a111ca5506008ae0b2c796039ef53aeebf4e2ba15e5241cb89def21ea3a633b6a609273085835b44a522165d871fa44067cdf29cccd
12224+
languageName: node
12225+
linkType: hard
12226+
12227+
"caniuse-lite@npm:^1.0.30001587":
12228+
version: 1.0.30001612
12229+
resolution: "caniuse-lite@npm:1.0.30001612"
12230+
checksum: 2b6ab6a19c72bdf8dccac824944e828a2a1fae52c6dfeb2d64ccecfd60d0466d2e5a392e996da2150d92850188a5034666dceed34a38d978177f6934e0bf106d
1222412231
languageName: node
1222512232
linkType: hard
1222612233

0 commit comments

Comments
 (0)