You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a user is signed up/signed in via social sign in (testing with Google), and then I hit Auth.signOut(), Amplify tries to open an oAuth consent screen, which displays nothing and just flashes up for a second then redirects back to the app.
I've tried to use Auth.signOut({global: true}) and have also tried removing some of the oAuth configuration from my aws-exports config file (as suggested on some of the other SDK github issues) but nothing works.
User should hit "sign out" in app, and the app should kick them back to an un-authed state without any jarring system popups.
Reproduction steps
Authenticate via social sign in
Hit await Auth.signOut()
Note that a system message saying [your app] wants to use "amazoncognito.com" to sign in. Note that the user is signing out here so this is a confusing message.
Code Snippet
Code comes almost directly from the React Native Amplify Auth docs
exportfunctionuseAuthWatcher(){const{ user }=useStores()const[authReady,setAuthReady]=useState(false)const[localUser,setLocalUser]=useState<any>(null)/* Listen to the authentication process */useEffect(()=>{constunsubscribe=Hub.listen("auth",({payload: { event, data }})=>{console.log("Got an event",{ event })switch(event){case"signIn":
case"signUp":
setLocalUser(data)breakcase"signOut":
setLocalUser(null)setAuthReady(true)breakcase"parsingCallbackUrl":
console.log({ data })}})Auth.currentAuthenticatedUser().then((currentUser)=>setLocalUser(currentUser)).catch(()=>{// If not signed in on first load, reset to base paramsconsole.log("Not signed in")user.authSignOut()setAuthReady(true)})returnunsubscribe},[])useEffect(()=>{;(async()=>{if(localUser){console.log("localUser",JSON.stringify(localUser))letdataToUpdateconstattributes=localUser.attributesconstidPayload=localUser?.signInUserSession?.idToken?.payloadconst{ email,email_verified: emailVerified}=attributes||idPayload||{}// If no email from Cognito, do nothingif(email){if(!emailVerified){dataToUpdate={
email,status: "DRAFT",}user.saveProfile(dataToUpdate)}else{letcurrentUsertry{// Get current user from the APIcurrentUser=awaituser.getCurrentUser()}catch(e){console.log("Unable to get current user",e)}if(!currentUser){dataToUpdate={
email,status: "INCOMPLETE",}awaituser.createUser(dataToUpdate)}}}}setAuthReady(true)})()},[localUser])return{ authReady }}
// Sign out methodasyncauthSignOut(){awaitAuth.signOut({global: true})analytics.event(ANALYTICS_EVENTS.USER_LOGOUT)self.setProp("profile",profileModel.create())},
Log output
// Put your logs below this line
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered:
Hi @jvgeee
We are aware of this confusing consent screen, currently it is a limitation from using Hosted UI and is being tracked in #3410
There is a potential workaround in the comments. I have not yet tried it myself but it seems to have resolved the issue for a few people.
I will close this issue so that we can consolidate our efforts but I would encourage you to thumbs up that issue so that we can better prioritize it. Also leave any additional comments there if you have more information for the thread.
If this wasn't the same issue please comment here and I will re-open this issue to assist you further.
Hi @tannerabread , I'm not using hosted UI (at least, I don't think I am? I have my own email/password screen with buttons for social sign up in-app and I just call the appropriate auth methods).
If Amplify potentially thinks I'm using hosted UI is there a way to make sure it's disabled?
@jvgeee sorry it does bypass the Hosted UI visually, but it still hits the Cognito Authentication Server for both the signIn and signOut which will end up showing that message.
From my understanding passing in the provider only bypasses the visual side of Hosted UI and still uses it to get to the provider's login page. I also don't believe there is currently a different way to use the social providers through Amplify.
I will discuss this with the team this week to verify my understanding is correct and get back to you. In the meantime, were you able to try the workaround I had posted and see if that solved the issue?
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
Describe the bug
When a user is signed up/signed in via social sign in (testing with Google), and then I hit
Auth.signOut()
, Amplify tries to open an oAuth consent screen, which displays nothing and just flashes up for a second then redirects back to the app.I've tried to use
Auth.signOut({global: true})
and have also tried removing some of the oAuth configuration from my aws-exports config file (as suggested on some of the other SDK github issues) but nothing works.This is potentially related to this issue: #4993
Expected behavior
User should hit "sign out" in app, and the app should kick them back to an un-authed state without any jarring system popups.
Reproduction steps
await Auth.signOut()
[your app] wants to use "amazoncognito.com" to sign in
. Note that the user is signing out here so this is a confusing message.Code Snippet
Code comes almost directly from the React Native Amplify Auth docs
// Amplify Setup
// Auth watcher
// Sign up function
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: