Skip to content

Instantly share code, notes, and snippets.

@dabit3
Created May 14, 2019 19:45
Show Gist options
  • Select an option

  • Save dabit3/6c4f0a06b5e39fd53567a4a521143efa to your computer and use it in GitHub Desktop.

Select an option

Save dabit3/6c4f0a06b5e39fd53567a4a521143efa to your computer and use it in GitHub Desktop.
Example of manual sign out using React Native & AWS Amplify
import React from 'react'
import { View, Text } from 'react-native'
import { withAuthenticator } from 'aws-amplify-react-native'
function App(props) {
function signOut() {
Auth.signOut()
.then(() => {
props.onStateChange('signedOut', null);
})
.catch(err => {
console.log('err: ', err)
})
}
return (
<View>
<Text>Hello World</Text>
<Text onPress={signOut}>Sign Out</Text>
</View>
)
}
export default withAuthenticator(App)
@ibqn
Copy link

ibqn commented Jan 4, 2022

This does not seem to work for react. Is it only for react native?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment