question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Auth.signOut does not sign out the user in React Native

See original GitHub issue

Describe 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

  1. Sign up a new user.
  2. Verify this user.
  3. Sign this user in.
  4. Run Auth.currentAuthenticatedUser();, this will return the user.
  5. Run Auth.signOut();, this will return undefined.
  6. 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:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
Benassoucommented, Sep 29, 2019

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.

0reactions
github-actions[bot]commented, Jun 12, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found