@@ -299,6 +299,7 @@ class DescopeFlowCoordinator(val webView: WebView) {
299299 } catch (e: DescopeException ) {
300300 if (e == DescopeException .oauthNativeCancelled) {
301301 logger.info(" OAuth native canceled" )
302+ sendResponse(FlowBridgeResponse .Failure (" OAuthNativeCancelled" ))
302303 return
303304 }
304305 logger.error(" OAuth native failed" , e)
@@ -310,9 +311,14 @@ class DescopeFlowCoordinator(val webView: WebView) {
310311 pendingDeepLinkType = request.variant
311312 logger.info(" Launching custom tab for ${request.variant} " )
312313 try {
313- launchCustomTab(webView.context, request.startUrl, flow?.presentation?.createCustomTabsIntent(webView.context))
314+ launchCustomTab(webView.context, request.startUrl, flow?.presentation?.createCustomTabsIntent(webView.context)) {
315+ // Custom tab dismissed by the user before completing the auth flow.
316+ pendingDeepLinkType = null
317+ sendResponse(FlowBridgeResponse .Failure (" WebAuthCancelled" ))
318+ }
314319 } catch (e: DescopeException ) {
315320 logger.error(" Failed to launch custom tab" , e)
321+ pendingDeepLinkType = null
316322 sendResponse(FlowBridgeResponse .Failure (" CustomTabFailure" ))
317323 }
318324 }
@@ -325,6 +331,7 @@ class DescopeFlowCoordinator(val webView: WebView) {
325331 } catch (e: DescopeException ) {
326332 if (e == DescopeException .passkeyCancelled) {
327333 logger.info(" Passkeys canceled" )
334+ sendResponse(FlowBridgeResponse .Failure (" PasskeyCancelled" ))
328335 return
329336 }
330337 val failure = when (e) {
@@ -353,6 +360,7 @@ class DescopeFlowCoordinator(val webView: WebView) {
353360 } catch (e: DescopeException ) {
354361 if (e == DescopeException .passkeyCancelled) {
355362 logger.info(" Passkeys canceled" )
363+ sendResponse(FlowBridgeResponse .Failure (" PasskeyCancelled" ))
356364 return
357365 }
358366 val failure = when (e) {
0 commit comments