mycoralhealth / mycoral-patient

Mobile app for patients to interact with Coral Health blockchain
17 stars 7 forks source link

Basic auth0 integration #38

Closed lukecyca closed 6 years ago

lukecyca commented 6 years ago

This PR adds a LoginScreen to the very top of the navigation hierarchy.

This login screen is functional now, but requires a number of refinements prior to merging:

  1. Automatically launch the login prompt, rather than having a "Login with Auth0" button
  2. Get proper branding on the Auth0 Web Auth screen (not sure why this isn't working — it appears to be configured correctly in Auth0)
  3. Put a "Logout" button that is accessible from inside the other app screens
  4. Carry the logged-in state around the entire app.
    • The responseObj.access_token is required for making subsequent requests to corald
    • We may also want to keep some user info for display purposes

Important: We are using an Expo service for AuthSession, which requires using exp start instead of react-native-scripts start. See here.

grcevski commented 6 years ago

Hey @lukecyca, here's what I think:

  1. Why don't we put this logout button in the settings screen? It can be one of the menu options or we can put a regular logout button at the bottom. It's where users would expect the logout to be.

  2. I think we can simply store the information in local storage like I store the user settings today. Instead of them filling them in manually (as it is in the current version) we'd just store the account info returned by auth0. What do you think? We already have a setter and a getter in store for username and email address, we just need to add one for the access token.

lukecyca commented 6 years ago

I addressed point 1 above, but the other three remain.

Merging as a WIP so we can work on this together.