@@ -113,13 +113,26 @@ const Authorization = WebexPlugin.extend({
113
113
return ret ;
114
114
} ,
115
115
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
+ */
123
136
initiateLogin ( options = { } ) {
124
137
options . state = options . state || { } ;
125
138
options . state . csrf_token = this . _generateSecurityToken ( ) ;
@@ -134,14 +147,23 @@ const Authorization = WebexPlugin.extend({
134
147
} ,
135
148
136
149
@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
+ */
145
167
initiateImplicitGrant ( options ) {
146
168
147
169
this . logger . info ( 'authorization: initiating implicit grant flow' ) ;
0 commit comments