Closed taouichaimaa closed 2 years ago
hey, @taouichaimaa I'm also facing the same issue but only on android. Did you find any solution for this?
Hello, unfortunately no. IOS works just fine but android has this issue.
Okay, @taouichaimaa thanks for the update. Please update me if you find anything, I'll also do the same.
Can you verify if the browser which is being opened during the sign-in flow supports custom tabs?
Hey, @div5yesh yes it does. Because I have another app running on older versions and in that it's working perfectly fine on same device and same browser.
Hey @div5yesh. I'm facing the same issue but I'm using another way for its implementation. Actually, I'm using Amplify.federatedSignIn(provider) method of aws-amplify. I'm stuck into this issue for the past 4-5 days. After a little debugging, I'm getting an error UNKNOWN_URL_SCHEME in debug mode on an android emulator. the same URI scheme seems to be working fine on iOS.
can you pls help me out? I can share more details regarding the issue if you require.
Please make sure your manifest has:
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name=
"android.support.customtabs.action.CustomTabsService" />
</intent>
</queries>
<application ...>
...
<activity
android:name="com.amazonaws.mobile.client.activities.HostedUIRedirectActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="myapp" />
</intent-filter>
</activity>
Hi, @poojamat what are you supposed to make sure in the manifest?
Can you verify if the browser which is being opened during the sign-in flow supports custom tabs?
mine does support custom tabs, I tried with chrome and opera on my physical phone but still same issue persists.
hello everyone I specify that I am integrating the social access and using cognito for the first time but I am also having the same problem I have entered HostedUIRedirectActivity
in the AndroidManifest
in the application tag
<activity
android:name="com.amplifyframework.auth.cognito.activities.HostedUIRedirectActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="myapp" />
</intent-filter>
</activity>
but in this line specifically <data android:scheme="myapp" />
I have entered the name of the app but as a URI I need it to go to MainActivity in case of logout it returns to access but it is not clear to me maybe in this way? <data android:scheme="myapp" android:host="mainactivity" />
in this way the uri would be of the type myapp://mainactivity
but I also have the same problem I add that I can log in and the user is saved but then the redirection does not take place
Are you having this problem on one specific device or all the devices?
hi @poojamat my manifest has the mentioned elements and it's on all devices. Any headway made into this?
Are you having this problem on one specific device or all the devices?
Also in my case it shows up on all devices
@taouichaimaa — it looks like the tutorial you linked is for the Android SDK section of the documentation (i.e. using AWSMobileClient
), while the code you’re showing is for the Amplify section of the documentation (i.e. using Amplify
) — did you happen to link the wrong documentation page? Also, could you make sure that your redirect URL in GCP is https://<your-user-pool-domain>/oauth2/idpresponse
? Please let us know if either of those changes resolves your issue. We were unable to reproduce your issue using Amplify version 1.31.1 — would you mind sharing your version number, as there were changes over the past year to fix some bugs with this code?
@Reenagrg100 and @elax46, your issues seem to be subtly different. If they are not resolved by these changes, I’d recommend that you open new issues with more specific details. For example: @Reenagrg100, I find it confusing that you say you’re using Amplify.federatedSignIn(provider)
when that particular API only exists on AWSMobileClient
to my knowledge, and to @elax46 I would expect that a followup question would be asking you what value you selected for your redirect signin/signout URIs when configuring Auth in the first place, so it would be beneficial to include that when creating a new issue.
Hope this helps!
@taouichaimaa — it looks like the tutorial you linked is for the Android SDK section of the documentation (i.e. using
AWSMobileClient
), while the code you’re showing is for the Amplify section of the documentation (i.e. usingAmplify
) — did you happen to link the wrong documentation page? Also, could you make sure that your redirect URL in GCP ishttps://<your-user-pool-domain>/oauth2/idpresponse
? Please let us know if either of those changes resolves your issue. We were unable to reproduce your issue using Amplify version 1.31.1 — would you mind sharing your version number, as there were changes over the past year to fix some bugs with this code?@Reenagrg100 and @elax46, your issues seem to be subtly different. If they are not resolved by these changes, I’d recommend that you open new issues with more specific details. For example: @Reenagrg100, I find it confusing that you say you’re using
Amplify.federatedSignIn(provider)
when that particular API only exists onAWSMobileClient
to my knowledge, and to @elax46 I would expect that a followup question would be asking you what value you selected for your redirect signin/signout URIs when configuring Auth in the first place, so it would be beneficial to include that when creating a new issue.Hope this helps!
Hi thanks for your answer I simply entered myapp://mainactivity/
and myapp://login/
the first to redirect to bring the user into main activity after access the second to return the user to the page to the login activity if he logs out since the documentation page does not indicate the use of android:host=""
I simply entered in the manifest <data android:scheme="myapp" />
the thing that is not clear in detail is what is meant by appname? the pakage or what else? from this point of view the documentation is unclear
Still facing the same issue
@poojamat, what are we supposed to make sure in AndroidManifest.xml?
@taouichaimaa — it looks like the tutorial you linked is for the Android SDK section of the documentation (i.e. using
AWSMobileClient
), while the code you’re showing is for the Amplify section of the documentation (i.e. usingAmplify
) — did you happen to link the wrong documentation page? Also, could you make sure that your redirect URL in GCP ishttps://<your-user-pool-domain>/oauth2/idpresponse
? Please let us know if either of those changes resolves your issue. We were unable to reproduce your issue using Amplify version 1.31.1 — would you mind sharing your version number, as there were changes over the past year to fix some bugs with this code? @Reenagrg100 and @elax46, your issues seem to be subtly different. If they are not resolved by these changes, I’d recommend that you open new issues with more specific details. For example: @Reenagrg100, I find it confusing that you say you’re usingAmplify.federatedSignIn(provider)
when that particular API only exists onAWSMobileClient
to my knowledge, and to @elax46 I would expect that a followup question would be asking you what value you selected for your redirect signin/signout URIs when configuring Auth in the first place, so it would be beneficial to include that when creating a new issue. Hope this helps!Hi thanks for your answer I simply entered
myapp://mainactivity/
andmyapp://login/
the first to redirect to bring the user into main activity after access the second to return the user to the page to the login activity if he logs out since the documentation page does not indicate the use ofandroid:host=""
I simply entered in the manifest<data android:scheme="myapp" />
the thing that is not clear in detail is what is meant by appname? the pakage or what else? from this point of view the documentation is unclear
@elax46 I think I see what's happening -- "appname" just refers to whatever URI prefix you chose, in this case "myapp". To match a logout URI of myapp://login/
the corresponding line you need to put in the manifest file <intent-filter>
is <data android:scheme="myapp" android:host="signout" />
and similarly for the redirect URI.
@poojamat, what are we supposed to make sure in AndroidManifest.xml?
To clarify, the important parts of the manifest file are:
<queries>
block (outside of the <application>
block)<activity android:name="com.amplifyframework.auth.cognito.activities.HostedUIRedirectActivity" ...> ...
block (inside the <application>
block) to handle both the login and the logout callbacks<activity android:name=".LogoutActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="myapp" android:host="signout" />
</intent-filter>
</activity>
where the name of the Activity (android:name="..."
) and the URI (android:scheme="myapp" android:host="signout"
, corresponding to myapp://signout
) match the Activity you want to redirect to and the URI you specified when configuring Auth.
I m still stuck on this Tried all the solutions
@taouichaimaa — it looks like the tutorial you linked is for the Android SDK section of the documentation (i.e. using
AWSMobileClient
), while the code you’re showing is for the Amplify section of the documentation (i.e. usingAmplify
) — did you happen to link the wrong documentation page? Also, could you make sure that your redirect URL in GCP ishttps://<your-user-pool-domain>/oauth2/idpresponse
? Please let us know if either of those changes resolves your issue. We were unable to reproduce your issue using Amplify version 1.31.1 — would you mind sharing your version number, as there were changes over the past year to fix some bugs with this code? @Reenagrg100 and @elax46, your issues seem to be subtly different. If they are not resolved by these changes, I’d recommend that you open new issues with more specific details. For example: @Reenagrg100, I find it confusing that you say you’re usingAmplify.federatedSignIn(provider)
when that particular API only exists onAWSMobileClient
to my knowledge, and to @elax46 I would expect that a followup question would be asking you what value you selected for your redirect signin/signout URIs when configuring Auth in the first place, so it would be beneficial to include that when creating a new issue. Hope this helps!Hi thanks for your answer I simply entered
myapp://mainactivity/
andmyapp://login/
the first to redirect to bring the user into main activity after access the second to return the user to the page to the login activity if he logs out since the documentation page does not indicate the use ofandroid:host=""
I simply entered in the manifest<data android:scheme="myapp" />
the thing that is not clear in detail is what is meant by appname? the pakage or what else? from this point of view the documentation is unclear@elax46 I think I see what's happening -- "appname" just refers to whatever URI prefix you chose, in this case "myapp". To match a logout URI of
myapp://login/
the corresponding line you need to put in the manifest file<intent-filter>
is<data android:scheme="myapp" android:host="signout" />
and similarly for the redirect URI.
Hey thanks, @tjleing my issues have been resolved the day I did my last comment. The issue was only related to I missed to add uri scheme in my AndroidManifest.xml file.
@taouichaimaa — it looks like the tutorial you linked is for the Android SDK section of the documentation (i.e. using
AWSMobileClient
), while the code you’re showing is for the Amplify section of the documentation (i.e. usingAmplify
) — did you happen to link the wrong documentation page? Also, could you make sure that your redirect URL in GCP ishttps://<your-user-pool-domain>/oauth2/idpresponse
? Please let us know if either of those changes resolves your issue. We were unable to reproduce your issue using Amplify version 1.31.1 — would you mind sharing your version number, as there were changes over the past year to fix some bugs with this code? @Reenagrg100 and @elax46, your issues seem to be subtly different. If they are not resolved by these changes, I’d recommend that you open new issues with more specific details. For example: @Reenagrg100, I find it confusing that you say you’re usingAmplify.federatedSignIn(provider)
when that particular API only exists onAWSMobileClient
to my knowledge, and to @elax46 I would expect that a followup question would be asking you what value you selected for your redirect signin/signout URIs when configuring Auth in the first place, so it would be beneficial to include that when creating a new issue. Hope this helps!Hi thanks for your answer I simply entered
myapp://mainactivity/
andmyapp://login/
the first to redirect to bring the user into main activity after access the second to return the user to the page to the login activity if he logs out since the documentation page does not indicate the use ofandroid:host=""
I simply entered in the manifest<data android:scheme="myapp" />
the thing that is not clear in detail is what is meant by appname? the pakage or what else? from this point of view the documentation is unclear@elax46 I think I see what's happening -- "appname" just refers to whatever URI prefix you chose, in this case "myapp". To match a logout URI of
myapp://login/
the corresponding line you need to put in the manifest file<intent-filter>
is<data android:scheme="myapp" android:host="signout" />
and similarly for the redirect URI.Hey thanks, @tjleing my issues have been resolved the day I did my last comment. The issue was only related to I missed to add uri scheme in my AndroidManifest.xml file.
Can you please share your AndroidManifest and redirect url as i am still facing this issue
@poojamat, what are we supposed to make sure in AndroidManifest.xml?
To clarify, the important parts of the manifest file are:
- the
<queries>
block (outside of the<application>
block)- the
<activity android:name="com.amplifyframework.auth.cognito.activities.HostedUIRedirectActivity" ...> ...
block (inside the<application>
block) to handle both the login and the logout callbacks- if you want to implement custom Activities for the login and logout callbacks, you need a block that looks similar to this:
<activity android:name=".LogoutActivity" android:exported="true"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="myapp" android:host="signout" /> </intent-filter> </activity>
where the name of the Activity (
android:name="..."
) and the URI (android:scheme="myapp" android:host="signout"
, corresponding tomyapp://signout
) match the Activity you want to redirect to and the URI you specified when configuring Auth.
Thanks with your suggestion I solved the question too. I remain of the idea that the documentation should be clearer on this point
@taouichaimaa — it looks like the tutorial you linked is for the Android SDK section of the documentation (i.e. using
AWSMobileClient
), while the code you’re showing is for the Amplify section of the documentation (i.e. usingAmplify
) — did you happen to link the wrong documentation page? Also, could you make sure that your redirect URL in GCP ishttps://<your-user-pool-domain>/oauth2/idpresponse
? Please let us know if either of those changes resolves your issue. We were unable to reproduce your issue using Amplify version 1.31.1 — would you mind sharing your version number, as there were changes over the past year to fix some bugs with this code? @Reenagrg100 and @elax46, your issues seem to be subtly different. If they are not resolved by these changes, I’d recommend that you open new issues with more specific details. For example: @Reenagrg100, I find it confusing that you say you’re usingAmplify.federatedSignIn(provider)
when that particular API only exists onAWSMobileClient
to my knowledge, and to @elax46 I would expect that a followup question would be asking you what value you selected for your redirect signin/signout URIs when configuring Auth in the first place, so it would be beneficial to include that when creating a new issue. Hope this helps!Hi thanks for your answer I simply entered
myapp://mainactivity/
andmyapp://login/
the first to redirect to bring the user into main activity after access the second to return the user to the page to the login activity if he logs out since the documentation page does not indicate the use ofandroid:host=""
I simply entered in the manifest<data android:scheme="myapp" />
the thing that is not clear in detail is what is meant by appname? the pakage or what else? from this point of view the documentation is unclear@elax46 I think I see what's happening -- "appname" just refers to whatever URI prefix you chose, in this case "myapp". To match a logout URI of
myapp://login/
the corresponding line you need to put in the manifest file<intent-filter>
is<data android:scheme="myapp" android:host="signout" />
and similarly for the redirect URI.Hey thanks, @tjleing my issues have been resolved the day I did my last comment. The issue was only related to I missed to add uri scheme in my AndroidManifest.xml file.
Can you please share your AndroidManifest and redirect url as i am still facing this issue
Hey @mmubeennisar, for your convenience I've made a gist of an AndroidManifest.xml
file that worked for me. Again, the Logout<activity>
block at the bottom is only necessary if you want to redirect to a particular Activity
when the user signs out; moreover, the URI that should be matched (in this case, myapp://signout/
) should match the SignOutRedirectURI
found in your app/res/raw/awsconfiguration.json
file, if you don't recall what it was from initializing the Auth category.
@poojamat, what are we supposed to make sure in AndroidManifest.xml?
To clarify, the important parts of the manifest file are:
- the
<queries>
block (outside of the<application>
block)- the
<activity android:name="com.amplifyframework.auth.cognito.activities.HostedUIRedirectActivity" ...> ...
block (inside the<application>
block) to handle both the login and the logout callbacks- if you want to implement custom Activities for the login and logout callbacks, you need a block that looks similar to this:
<activity android:name=".LogoutActivity" android:exported="true"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="myapp" android:host="signout" /> </intent-filter> </activity>
where the name of the Activity (
android:name="..."
) and the URI (android:scheme="myapp" android:host="signout"
, corresponding tomyapp://signout
) match the Activity you want to redirect to and the URI you specified when configuring Auth.Thanks with your suggestion I solved the question too. I remain of the idea that the documentation should be clearer on this point
Good callout, I've created this PR on the docs site to address that point.
@poojamat, what are we supposed to make sure in AndroidManifest.xml?
To clarify, the important parts of the manifest file are:
- the
<queries>
block (outside of the<application>
block)- the
<activity android:name="com.amplifyframework.auth.cognito.activities.HostedUIRedirectActivity" ...> ...
block (inside the<application>
block) to handle both the login and the logout callbacks- if you want to implement custom Activities for the login and logout callbacks, you need a block that looks similar to this:
<activity android:name=".LogoutActivity" android:exported="true"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="myapp" android:host="signout" /> </intent-filter> </activity>
where the name of the Activity (
android:name="..."
) and the URI (android:scheme="myapp" android:host="signout"
, corresponding tomyapp://signout
) match the Activity you want to redirect to and the URI you specified when configuring Auth.Thanks with your suggestion I solved the question too. I remain of the idea that the documentation should be clearer on this point
Good callout, I've created this PR on the docs site to address that point.
at great I didn't know the amplify doc site was on github😀😀
guide
Hi, i linked that guide since i used the initial set up to link my project to google and facebook. The redirect url looks like you've mentionned. I'm usinf amplify v1.31.
This is my AndroidManifest.xml file after making required changes. But still it doesn't work. Can't figure out why. The issue appears to be, that that the android application is not able to redirect back to the app, after signing in from the browser. It works fine on iOS though.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp.app">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="com.android.vending.BILLING" />
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name=
"android.support.customtabs.action.CustomTabsService" />
</intent>
</queries>
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
<meta-data android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id"/>
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:label="@string/app_name" />
<activity
android:name="com.amplifyframework.auth.cognito.activities.HostedUIRedirectActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="myapp" />
</intent-filter>
</activity>
<activity
android:name="com.facebook.CustomTabActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="@string/fb_login_protocol_scheme" />
</intent-filter>
</activity>
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:exported="true"
>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="myapp" android:host="login" />
</intent-filter>
</activity>
<activity
android:name=".SplashActivity"
android:theme="@style/SplashTheme"
android:label="@string/app_name"
android:exported="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Still facing the same issue :(
<activity android:name="com.amazonaws.mobile.client.activities.HostedUIRedirectActivity" android:exported="true">
I am still getting the issue, pasting my android manifest below:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapp">
<uses-permission android:name="android.permission.INTERNET" />
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name=
"android.support.customtabs.action.CustomTabsService" />
</intent>
</queries>
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
android:exported="true"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.amazonaws.mobile.client.activities.HostedUIRedirectActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="myapp" />
</intent-filter>
</activity>
</application>
</manifest>
I am facing this issue. I have included the scheme and host as mentioned above. But the issue is not resolved.
Including the sheme = "myapp"
and host = "signin"
worked for me when used as <data android:scheme="myapp" android:host="signin" />
. But I used this inside the <activity android:name="com.amplifyframework.auth.cognito.activities.HostedUIRedirectActivity" ...>
itself.
I might have been able to reproduce this issue specifically with Facebook -- it looked like it popped up the redirect for a second but immediately came back to the FB window. Will look more into this.
It's been almost a month since this issue was first created yet I still don't see any official solution ? Is it possible it's happening because the ANDROID SDK doesn't support both normal signIn and SignInWithWebUI ?
<data android:scheme="myapp" android:host="signout" />
I'm using fragments , not activities. Is it still applicable?
I'm using fragments , not activities. Is it still applicable?
That certainly could be the issue. Would you mind switching to activities and seeing if that restores functionality? If so we would be able to do a more detailed investigation.
Hi, sorry no can do. I'm already at 70% done with my project .
@taouichaimaa Sorry to hear that. There is no support for fragments for HostedUI as of yet. But it is something we can look at in future. Would you mind sharing how you are using fragments for redirection with sensitive information redacted here?
Closing this issue as the root cause has been reported to be fixed and no new activity. We will look into supporting Fragments in future. If you feel like you are still impacted by this issue, please reopen.
Describe the bug I'm integrating social signIn using Facebook and google into my android app. I'm using this guide . when the user clicks on the social sign in button, he gets added to the social pool however the app does not redirect. For Google, it stays loading the redirection url with a blank webview. this is the redirect URL https://projectxyz13568-ffff-local.auth.us-east-1.amazoncognito.com/oauth2/authorize?client_id=4hmdq6hcn2cjj6cl9q57vnhhvi&redirect_uri=redirectURI%3A%2F%2F&response_type=code&code_challenge=sreyQtr86U6HWSgzQ04wnSpi2rKyyAX5azG21KoNUxc&code_challenge_method=S256&state=CRVUtDPhnXMQz967j_CZe60cNJvvk0ga7IIbSyDvN2o&userContextData=null&identity_provider=Google
in the first tries, it allows to choose the account if there's multiple accounts on the device but after that it just keeps loading nothing. just a blank webview. When I close the webview I get the ' authentication flow canceled by user'.
To Reproduce A code sample or steps:
Which AWS service(s) are affected?
Expected behavior User chooses account, signs in and gets redirected to my application, homefragment
Screenshots
Environment Information (please complete the following information):
Additional context Add any other context about the problem here.