Mock Auth backend component for local dev
See original GitHub issueThis would be similar in purpose to #882 .
By mocking the Auth component we would decrease new dev onboarding friction while also reducing the need to widely share the dev auth account secret.
If the AUTH_SECRET_KEY
is not present it will use the mock, otherwise Auth0 itself.
Users specifically developing auth features would add the key and thus be able to work with the real thing. Those not needing to, can just rely on the mock so they can get on with developing other features.
A few notes on likely implementation:
- All we would be mocking are the methods used in
/auth/login
https://github.com/FightPandemics/FightPandemics/blob/ad05066e1ae4375c0d7045779c4c329faa44c5c8/backend/lib/endpoints/auth.js#L117 - It’ll only easily work with email/password, not social since we’d need to mock the oauth providers (more complicated than it’s worth for purpose of this issue
- Idea is dev just goes to login (no sign-up). The password is handled by Auth0 and not stored in our DB so we’ll just ignore it with the mock. ~If the user exists they will be logged in. If they don’t exist they will be signed-in and then proceed to create their profile as usual which saves the user to the database.~ A better idea is that we add 5 users via DB seeding for local dev - we can use https://github.com/pkosiec/mongo-seeding and run this as part of
Dockerfile.dev
build step.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Create a mock back end for realistic data interactions with React
Authenticating users with a fake back end · Step 1: Configure a fake back end for local development · Step 2: Write a...
Read more >9 helpful tools for creating mock REST servers
9 tools and techniques for mocking HTTP requests - from API design suites to online and local mock servers - to ensure product...
Read more >The Basic Necessities of a Mock User Authentication with json ...
Going through the flow of a new user, we will first want to sign up component that will be shown on our front...
Read more >Angular 7 - Mock Backend Example for Backendless ...
A fake backend is used for doing backendless development in Angular which allows you to demo your code without the need to create...
Read more >Create Rest Mock API in Seconds With These 9 Tools
API mocking is a potent concept that has become a crucial part of the ... Both frontend and backend developers who need Mock...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @vnessa-su @joshmorel I think that this solution will also be ideal for automation tests.
@jessica-lau Issue important for automation QA team 😃
@joshmorel Thank you!