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: use mock authentication for local dev #32935
Conversation
Requires freeCodeCamp/loopback-component-passport#4 to be merged first. This needs to be tested locally and by someone familiar with auth. For sure you need to pay close attention to cookies and clearing them when needed to make sure auth is really happening. @raisedadead There is only one thing left to do and that's to seed the db with the test user. I will work on that now, but since it is trivial you can start reviewing this code which is ready. |
752cd42
to
453f9c7
Compare
package.json
Outdated
@@ -9,6 +9,7 @@ | |||
"lint": "echo 'Warning: TODO - Define Linting.'", | |||
"pretest-ci": "npm-run-all -s lint bootstrap", | |||
"seed": "cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedChallenges", | |||
"seed-auth-user": "cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedAuthUser", |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@@ -0,0 +1,101 @@ | |||
const path = require('path'); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
@raisedadead This is complete now. But I could use your help in organizing parts of this per the previous comments. |
@raisedadead I just remembered I forgot to seed the |
Hi @tchaffee, thanks for preparing this PR. I'll pull this down and get back to you. |
package.json
Outdated
@@ -9,6 +9,7 @@ | |||
"lint": "echo 'Warning: TODO - Define Linting.'", | |||
"pretest-ci": "npm-run-all -s lint bootstrap", | |||
"seed": "cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedChallenges", | |||
"seed-auth-user": "cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedAuthUser", |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
package.json
Outdated
@@ -9,6 +9,7 @@ | |||
"lint": "echo 'Warning: TODO - Define Linting.'", | |||
"pretest-ci": "npm-run-all -s lint bootstrap", | |||
"seed": "cross-env DEBUG=fcc:* node ./tools/scripts/seed/seedChallenges", |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
@@ -0,0 +1,101 @@ | |||
const path = require('path'); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
I am quite happy with the logic flow. I am yet to test this out. Unrelated side notes: (This is not at all a concern of this PR and must be taken later)
Again just for discussion, do not worry about it right now. I am pretty sure we abandoned it for some reason that I can't recall. |
I'll get back with a update when I am done testing. Thanks for your patience. |
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 forgot! Could you please update the sample.env
with this default value for local env variable.
By default the setup starts in development mode.
So, what I can see from your changes: // This is the same format as would be returned by Auth0.
// The id comes from a record that should already be in the db
// due to seeding at development time.
const accessToken = {
id: 'nyynsTyQrmXNo8APMKiG7SAkSvsBiC1XnZ8QhI2GuhfixAaV6hEpuJ5gFTNeEcJU',
ttl: 77760000000,
created: new Date().toISOString(),
userId: u.id
}; This is where you are bypassing the AccessToken creation with Loopback and hardcoding it. I think we are probably going to be fine using this hack 😉 ! Since, the real reason behind the local auth is to let collaborators to be able to work with pages that are hidden behind an authenticated user, this works perfectly for our needs. |
453f9c7
to
d2de3f3
Compare
d2de3f3
to
75f1ce2
Compare
@raisedadead I added |
@tchaffee this works locally for me. Welcome page "Goto to next challenge" button seems to be dead, but curriculum menu item works. |
We are still working on a couple things for the platform, and hence the delay on getting this merged. But just to let you know:
This is known and Stuart has already dropped a fix.
This is a unfortunate limitation of Gatsby's Dev Server for the moment. The public profile page is actually available and you should see it just fine if you click the button that says Please note this will not be an issue when the client site is deployed to the production. You won't have the dev server intercepting the dynamic routes. We would need a fix to the Gatsby core to address this and I think they have something in works. Until then you can simply click the button to get you to the right page when you are developing. |
75f1ce2
to
be55655
Compare
@nikrb thank you for testing this. @raisedadead I think I've made all your requested changes. Is there anything else I need to do on this or are we just waiting now for other stuff? |
@raisedadead Could you take another look at this and see whether it's ready to go (aside from the merge conflicts)? This could be a huge improvement to onboarding new contributors. |
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.
Needs updated @freeCodeCamp/loopback-component-passport
be55655
to
a91ad35
Compare
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.
Nice work @tchaffee !
I have taken the liberty and did some chores. Other than that this was an awesome PR to QA. Thanks for your patience with this and the hard work.
Happy contributing!
Update index.md
)master
branch of freeCodeCamp.Closes #17382