-
Notifications
You must be signed in to change notification settings - Fork 285
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add sign in/up info in auth URL generated by Passport #320
Conversation
5078185
to
d9579d3
Compare
9385756
to
e2dd45c
Compare
e2dd45c
to
ee705eb
Compare
@impactmass It seems that once I've created an account and signed in once. Even if I visit http://localhost:4000/logout to sign out, If I sign in again, I get auto signed in with the last account I signed in with.
|
@mikemurray thanks, good call 👍 . I'm checking on it. This is directly related to having the Hydra sessions working. So when logging out from the Starter kit, there needs to be a call to invalidate the session in Hydra as well. I'll check if it's a 'small' fix that can be added to this PR (or if it needs to be broken out into another). The reason for Hydra tracking session is here:
|
Also moved splitname helper into Authstore, making it available for reuse beyond Header comp
Ready for another review |
@seun As discussed eariler and just adding it here for reference... When I try to sign out, the app never goes to the What I do see is the following warning in the console:
|
@mikemurray I've been looking into this after we discussed, and getting different variations of that error: |
71e2e0c
to
6bedc76
Compare
This commit fixed the issue with the Authstore & re-rendering after logout: |
@impactmass I created a merge conflict by approving another PR I'll resolve. |
…tioncommerce/reaction-next-starterkit into feat-4640-impactmass-idp-form-state
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.
When I sign up for a new account I get the following error when I'm redirected back to the starter kit.
Seems to be an issue with splitNames
, keeping in mind that a new account has no name, so it will be null.
Cannot read property 'split' of null
TypeError: Cannot read property 'split' of null
at AuthStore.splitNames (src/lib/stores/AuthStore.js:76:0)
at AuthStore.setAccount (src/lib/stores/AuthStore.js:89:0)
at executeAction (/usr/local/src/node_modules/mobx/lib/mobx.js:195:19)
at AuthStore.res (/usr/local/src/node_modules/mobx/lib/mobx.js:187:16)
at /usr/local/src/reaction-app/src/.next/server/bundles/pages/_app.js:2901:23
at Query.render (/usr/local/src/node_modules/react-apollo/react-apollo.umd.js:422:20)
at processChild (/usr/local/src/node_modules/react-dom/cjs/react-dom-server.node.development.js:2207:18)
at resolve (/usr/local/src/node_modules/react-dom/cjs/react-dom-server.node.development.js:2064:5)
at ReactDOMServerRenderer.render (/usr/local/src/node_modules/react-dom/cjs/react-dom-server.node.development.js:2383:22)
at ReactDOMServerRenderer.read (/usr/local/src/node_modules/react-dom/cjs/react-dom-server.node.development.js:2357:19)
at renderToString (/usr/local/src/node_modules/react-dom/cjs/react-dom-server.node.development.js:2729:25)
at Object.renderPage (/usr/local/src/node_modules/next/dist/server/render.js:275:26)
at Function._class.getInitialProps (src/pages/_document.js:22:0)
at _callee$ (/usr/local/src/node_modules/next/dist/lib/utils.js:111:30)
at tryCatch (/usr/local/src/node_modules/regenerator-runtime/runtime.js:62:40)
at Generator.invoke [as _invoke] (/usr/local/src/node_modules/regenerator-runtime/runtime.js:296:22)
at Generator.prototype.(anonymous function) [as next] (/usr/local/src/node_modules/regenerator-runtime/runtime.js:114:21)
at step (/usr/local/src/node_modules/next/node_modules/@babel/runtime/helpers/asyncToGenerator.js:12:30)
at _next (/usr/local/src/node_modules/next/node_modules/@babel/runtime/helpers/asyncToGenerator.js:27:9)
at /usr/local/src/node_modules/next/node_modules/@babel/runtime/helpers/asyncToGenerator.js:34:7
at new Promise (<anonymous>)
at new F (/usr/local/src/node_modules/core-js/library/modules/_export.js:36:28)
src/lib/stores/AuthStore.js
Outdated
// See https://github.com/reactioncommerce/reaction/issues/4646 | ||
splitNames(account) { | ||
const { name } = account; | ||
const [firstName, lastName] = name.split(" "); |
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.
@mike probably from this?
Maybe something like const [firstName, lastName] = name && name.split(" ");
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.
Okay. Will push a fix
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.
LGTM! 👍
Part of reactioncommerce/reaction/issues/4640
Type: feature
Issue
When a Starterkit user clicks "Register", we redirect to the Reaction Hydra login page, but it shows the "Sign In" view rather than "Create Account" view.
Solution
Pass extra info to Hydra about the specific auth flow the user is going through: Sign up OR Sign in.
Changes
/auth
route into two distinct/signin
andsignup
routes to allow requirement above (I couldn't find a way around it with single route)splitnames
helper into AuthStore, making it available for reuse beyond Header compBreaking changes
N/A
Testing
NB: This is to be tested along with reactioncommerce/reaction/pull/4651