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

[Refactor] Refactoring Auth #263

Closed
1 of 2 tasks
hermannleboss opened this issue Jul 14, 2024 · 0 comments · Fixed by #270
Closed
1 of 2 tasks

[Refactor] Refactoring Auth #263

hermannleboss opened this issue Jul 14, 2024 · 0 comments · Fixed by #270

Comments

@hermannleboss
Copy link
Contributor

hermannleboss commented Jul 14, 2024

Description

Close #261

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like

  • Process of authentication

Get the user nonce: /api/user/nonce/{address}
Sign and return to /api/auth/siwe
And SIWE should return a token
Use the token to authenticate the user /api/user/{address}
And you get the user informations
Then redirection to home page

  • Expected user Story
    When the user is not authenticated
    Then the value the user should be:
{
  "user": null,
  "userIsAuth": false,
  "authToken": null
}

When the user is authenticated
Then the value the user should be

{
  "user": {
    "address": "0x...",
     //...
  },
  "userIsAuth": true,
  "authToken": "[token]"
}

When the user is authenticated and go to the login page
Then the user should be redirected to the home page

When the user is not authenticated and go to another page than the login page
Then the user should be redirected to the login page

When the user is authenticated and have and 401 error
Then the user should be logout then redirected to the login page

When the logout app is called
Then the value the user should be set to

{
  "user": null,
  "userIsAuth": false,
  "authToken": null
}

When the user sign in
Then the value of the user should be set to

{
  "user": {
    "address": "0x...",
      //...
  },
  "userIsAuth": true,
  "authToken": "[token]"
}

How to know if the user is authenticated

When the auth token is not null or the fetch do not return a 401 error.
Then the app consider the user as authenticated

When the auth token is null or the fetch return a 401 error.
Then the app consider the user as not authenticated
And the user should be logedout

Acceptance Criteria

  • All User stories pass

Tasks

  1. aliassan
@hermannleboss hermannleboss pinned this issue Jul 14, 2024
@hermannleboss hermannleboss changed the title [Refactor] Refactoring Auth User Story [Refactor] Refactoring Auth Jul 15, 2024
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.

1 participant