@@ -186,14 +186,21 @@ open class OAuth2: OAuth2Base {
186186 - parameter params: Optional key/value pairs to pass during authorization
187187 */
188188 open func do Authorize( params: OAuth2StringDict? = nil ) async throws -> OAuth2 JSON? {
189- if authConfig. authorizeEmbedded {
190- try await doAuthorizeEmbedded ( with: authConfig, params: params)
191- }
192- else {
193- try doOpenAuthorizeURLInBrowser ( params: params)
189+ return try await withCheckedThrowingContinuation { continuation in
190+ Task {
191+ do {
192+ if authConfig. authorizeEmbedded {
193+ try await doAuthorizeEmbedded ( with: authConfig, params: params)
194+ }
195+ else {
196+ try doOpenAuthorizeURLInBrowser ( params: params)
197+ }
198+ self . doAuthorizeContinuation = continuation
199+ } catch {
200+ continuation. resume ( throwing: error)
201+ }
202+ }
194203 }
195-
196- return nil // TODO
197204 }
198205
199206 /**
@@ -229,7 +236,7 @@ open class OAuth2: OAuth2Base {
229236 Method that creates the OAuth2AuthRequest instance used to create the authorize URL
230237
231238 - parameter redirect: The redirect URI string to supply. If it is nil, the first value of the settings' `redirect_uris` entries is
232- used. Must be present in the end!
239+ used. Must be present in the end!
233240 - parameter scope: The scope to request
234241 - parameter params: Any additional parameters as dictionary with string keys and values that will be added to the query part
235242 - returns: OAuth2AuthRequest to be used to call to the authorize endpoint
@@ -279,7 +286,7 @@ open class OAuth2: OAuth2Base {
279286 Convenience method to be overridden by and used from subclasses.
280287
281288 - parameter redirect: The redirect URI string to supply. If it is nil, the first value of the settings' `redirect_uris` entries is
282- used. Must be present in the end!
289+ used. Must be present in the end!
283290 - parameter scope: The scope to request
284291 - parameter params: Any additional parameters as dictionary with string keys and values that will be added to the query part
285292 - returns: NSURL to be used to start the OAuth dance
0 commit comments