-
Notifications
You must be signed in to change notification settings - Fork 790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
add logout #131
add logout #131
Conversation
} else { | ||
Linking.openURL(url); | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like openLink is a fairly complex method that will (and should) likely be used in other places. Not sure where it should be moved to, though, maybe utils
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed it's already being used elsewhere, will update it in a bit 馃檶
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done - moved it to a helper method 馃憤
* Show logout option on profile page. Show alert when clicking logout * WIP clear cache and navigate back to login screen * Use absolute imports * Processing feedback of the PR and wip code to signout * Signing out is working, navigating back to login screen.
I don't really understand the inner-workings of how the login session is maintained, but would something like https://github.com/reactnativecn/react-native-http-cache/ work? |
Hmm thanks will take a look at that tomorrow for sure. The logout flow is relatively straightforward but it's just that the password/username persists in Safari hence it logs you in automatically when a user logs out and tries to sign in again (as opposed to having you type your details once more) |
Ah ok. Yea clearing the cache seems like it'd probably work (right?) but not sure if the package I linked above will do that. |
Logging out is a little tricky, I can't thank you enough @RolfKoenders for getting it started and apologize you didn't have the easiest thing to start working on.
We use the
Oauth
web flow in the application and notBasic Authentication
. In the API, revoking access tokens and deleting authorizations only work forBasic Authentication
.This PR does the following:
AuthProfileScreen
(Check for updates tap target is a bit bigger now, centered and darkened note on requesting access on repos, made surefontSizes
were normalized.auth
reducer portion of the Redux store is cleared. That's where we store the access token andisAuthenticated
logicAsyncStorage
is also cleared because the Redux store is persisted thereAll this works just fine. The tricky part is when the user clicks login once again. This is how it would work:
Notice how I didn't have to type in my username and password again. This is because I'm still logged in to Safari hence why I'm just redirected right back with a new access token.
So here's what I did: open
github.com/logout
using the Safari View to allow the user to log out through the browser. Unfortunately they have to clickDone
to be able to navigated back to the app (I don't know if it's possible to redirect automatically after a Safari event)Let me know what you folks think, and please let me know if there's anything I should change in this PR 馃檶