From 729665bddd3e8a9644347ec43c1a56fc69147249 Mon Sep 17 00:00:00 2001 From: Divyesh Chitroda Date: Mon, 7 Nov 2022 12:10:48 -0800 Subject: [PATCH] fix(android): add instuctions to handle sign in cancellation for webui --- src/fragments/sdk/auth/android/hosted-ui.mdx | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/fragments/sdk/auth/android/hosted-ui.mdx b/src/fragments/sdk/auth/android/hosted-ui.mdx index f7c35521615..a320d29c04a 100644 --- a/src/fragments/sdk/auth/android/hosted-ui.mdx +++ b/src/fragments/sdk/auth/android/hosted-ui.mdx @@ -368,6 +368,22 @@ If you want to sign out locally by just deleting tokens, you can call `signOut` AWSMobileClient.getInstance().signOut(); ``` +### Add Response handler + +Add the result handler if you need to capture sign in cancellations that occurred before the user submitted credentials. + +```java +@Override +protected void onActivityResult(int requestCode, int resultCode, Intent data) { + super.onActivityResult(requestCode, resultCode, data); + + if (requestCode == AuthClient.CUSTOM_TABS_ACTIVITY_CODE && + resultCode == Activity.RESULT_CANCELLED) { + // handle cancelled sign in + } +} +``` + ### Manual Setup To configure your application for hosted UI, you need to use *HostedUI* options. Update your `awsconfiguration.json` file to add a new configuration for `Auth`. The configuration should look like this: