Auth.signOut does not sign out the user in React Native
See original GitHub issueDescribe the bug
Using Auth.signOut();
per the documentation does not sign the user out in a React Native application i.e. Auth.currentAuthenticatedUser();
still returns the same user as before while the then callback receives undefined
as parameter. Instead Auth.currentAuthenticatedUser().then(user => user.signOut());
does work as expected.
To Reproduce Create a fresh install using the official Amplify documentation for React Native (https://aws-amplify.github.io/docs/js/start?platform=react-native). Then
- Sign up a new user.
- Verify this user.
- Sign this user in.
- Run
Auth.currentAuthenticatedUser();
, this will return the user. - Run
Auth.signOut();
, this will return undefined. - Run
Auth.currentAuthenticatedUser();
, this will still return the user.
Expected behavior
I would expect Auth.signOut();
to automatically sign out the currently authenticated user.
Smartphone (please complete the following information):
- Device: Samsung s4
- OS: Android 7
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Firebase user signOut doesn't work in react native
I'm building an app and I'm handling the authentication with Firebase. The signIn create user functions work ...
Read more >Authentication - Sign up, Sign in & Sign out - React Native
Sign -up. Create a new user in the Amazon Cognito UserPool by passing the new user's email address, password, and other attributes to...
Read more >User LogIn and LogOut for React Native | Back4app Guides
In this guide you'll learn how to login and logout a user in Parse on React Native.
Read more >Authentication in React Native using Firebase part 2 - Medium
Now we can sign the user in. But there is more to be done. We need to hide the login form on a...
Read more >Sign users out | Okta Developer
import React, { Component } from 'react'; import { withOktaAuth } from '@okta/okta-react'; // Basic component with logout button class Logout extends Component ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t think the problem is solved yet, at least not for me. I just used
Auth.currentAuthenticatedUser()
to get the current user. You can then sign out the user using the returned user object.This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server
*-help
channels or Discussions for those types of questions.