Skip to content
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

NOT DONE [Auth FE] AASignedInUser I generate a JWT which contains my userId #181

Closed
5 tasks done
mattzcarey opened this issue Aug 15, 2023 · 2 comments · Fixed by #215
Closed
5 tasks done

NOT DONE [Auth FE] AASignedInUser I generate a JWT which contains my userId #181

mattzcarey opened this issue Aug 15, 2023 · 2 comments · Fixed by #215
Assignees

Comments

@mattzcarey
Copy link
Owner

mattzcarey commented Aug 15, 2023

Description:
We need to secure our APIs. This means we will have to use jwt tokens at some point to authenticate them.

dependent on #178

Current plan is to use a jwt token from next-auth in combination with the database adapter to store users. The flow looks like this:

  1. Use JWT with NextAuth:
    When a user logs in via NextAuth, generate a JWT that contains the user's unique identifier (like a user ID). This JWT should be signed using a secure secret key. This will need to be added to the next-auth config.

  2. Securely Store Secret Key:
    Store the secret key used to sign the JWT securely with SST in the secret config.

  3. Make Requests to API Gateway with JWT:
    When making requests to the API Gateway, include the JWT as an Authorization header, typically as a Bearer token.

eg. Authorization: Bearer <token>

Validation Steps:
When I sign in I am generated a jwt token which is stored in a cookie
Screenshot of this decoded token in the backend lambda getUser

Tech Steps:

  • Update the next-auth to use jwt tokens.
  • store the jwt secret using sst config
  • update the callbacks to add the userid to the jwt
  • update the useAxios hook to include the Authorization header as default.
  • update the getUser and addUser lambda to use userId as the unique identifier
@mattzcarey mattzcarey converted this from a draft issue Aug 15, 2023
@mattzcarey mattzcarey added this to the v2 - SaaS platform milestone Aug 15, 2023
@mattzcarey mattzcarey changed the title [Auth FE] AAUser I am generated a JWT which contains my userId [Auth FE] AAUser I generate a JWT which contains my userId Aug 15, 2023
@mattzcarey mattzcarey changed the title [Auth FE] AAUser I generate a JWT which contains my userId [Auth FE] AASignedInUser I generate a JWT which contains my userId Aug 15, 2023
@mattzcarey mattzcarey moved this from TR Done to Sprint Backlog in Code Review GPT Roadmap Aug 15, 2023
@ChristianN1234 ChristianN1234 moved this from Sprint Backlog to Daily goals in Code Review GPT Roadmap Aug 22, 2023
@SEBRATHEZEBRA SEBRATHEZEBRA moved this from Daily goals to In Progress in Code Review GPT Roadmap Aug 23, 2023
@SEBRATHEZEBRA SEBRATHEZEBRA linked a pull request Aug 25, 2023 that will close this issue
@SEBRATHEZEBRA
Copy link
Contributor

Image

@SEBRATHEZEBRA SEBRATHEZEBRA moved this from In Progress to Code Review in Code Review GPT Roadmap Aug 29, 2023
@SEBRATHEZEBRA SEBRATHEZEBRA moved this from Code Review to Functional Review in Code Review GPT Roadmap Aug 30, 2023
@mattzcarey mattzcarey moved this from Functional Review to To Validate in Code Review GPT Roadmap Aug 31, 2023
@SEBRATHEZEBRA SEBRATHEZEBRA moved this from To Validate to In Progress in Code Review GPT Roadmap Sep 4, 2023
@mattzcarey
Copy link
Owner Author

Back from validation. This ticket never created the jwt.

@mattzcarey mattzcarey closed this as not planned Won't fix, can't repro, duplicate, stale Sep 4, 2023
@mattzcarey mattzcarey moved this from In Progress to Done in Code Review GPT Roadmap Sep 4, 2023
@mattzcarey mattzcarey moved this from Done to Functional Review in Code Review GPT Roadmap Sep 5, 2023
@mattzcarey mattzcarey changed the title [Auth FE] AASignedInUser I generate a JWT which contains my userId NOT DONE [Auth FE] AASignedInUser I generate a JWT which contains my userId Sep 7, 2023
@mattzcarey mattzcarey moved this from Functional Review to To Validate in Code Review GPT Roadmap Sep 7, 2023
@mattzcarey mattzcarey moved this from To Validate to Done in Code Review GPT Roadmap Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants