Closed crucialfelix closed 3 years ago
I've added https://accounts.plant-for-the-planet.org
as a custom domain in Auth0,
This means instead of calling
https://planetapp.eu.auth0.com/
you can call https://accounts.plant-for-the-planet.org
btw. that custom domain you added just relocates to https://plant-for-the-planet.org
It is Auth0 doing the relocating so maybe its a configuration issue that I can't find.
@crucialfelix
https://planetapp.eu.auth0.com/ redirects to auth0 so https://plant-for-the-planet.org redirects to our home; but
calling api with https://accounts.plant-for-the-planet.org
like: https://planetapp.eu.auth0.com/api/v2/ should be fine.
Reference app:
https://github.com/auth0-samples/auth0-react-samples/blob/master/01-Login/README.md
auth flow
trilliontrees://deep-link/url
)Using the
AuthProvider
from the reference app, we can then get user auth information in any functional component:https://github.com/auth0-samples/auth0-react-samples/blob/master/01-Login/src/components/NavBar.js https://github.com/auth0-samples/auth0-react-samples/blob/master/01-Login/src/views/Profile.js
Current auth system
Almost all of the current routes and components for authentication will no longer be used. Keep them in place for now, they may be removed in a future PR.
routes
Defined in: web: app/components/App/TreeCounter.js native: app/components/Navigators/AppDrawerNavigator.js
components
redux actions
app/actions/authActions.js
login
logoutUser
forgot_password
sendEmail
reset_password
redux selectors
Changes and Additions
[x] Add example Auth0 settings to config/index.dist.js We don't keep the client secret in git of course.
[x] Copy
AuthProvider
See: https://github.com/auth0-samples/auth0-react-samples/blob/master/01-Login/src/react-auth0-spa.jsThis is wrapped around the main app and allows any functional component to access userProfile with:
[x] New route:
/auth0-callback
This is where Auth0 relocates the user to with user profile as an encrypted GET param. TODO: I'm not yet sure if need to do anything other than relocate them to home.[x] New route:
/authorize
Relocate user immediately tohttps://accounts.plant-for-the-planet.org/authorize
(hosted on auth0)Auth0 may need to relocate a user to our domain just so we can relocate them back to auth0. This is for security reasons to prove that we are in control of the domain that will store cookies.
[x] New route:
/logout
After callingthe user is redirected to Auth0.com then back to
/logout
(this route). Just relocate them to/
I guess[x]
PrivateRoute
Change to use this version: https://github.com/auth0-samples/auth0-react-samples/blob/master/01-Login/src/components/PrivateRoute.jscurrent versions are located: web: app/components/App/TreeCounter.js native: app/components/Navigators/AppDrawerNavigator.js