givebloodorg/doesangue-webapp

Authenticate a user and save the token in localStorage

JoseCage opened this issue · 5 comments

Using the axios lib, make a POST request to API route /v1/auth/register with required parameters

  • first_name
  • last_name
  • username
  • email
  • password
  • birthdate

Expected result:

{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjgsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC92MS9hdXRoL3JlZ2lzdGVyIiwiaWF0IjoxNTA2NDI3MTIxLCJleHAiOjE1MDY0MzA3MjEsIm5iZiI6MTUwNjQyNzEyMSwianRpIjoiWFc2SXRpRGhHUDhqbGJvciJ9.4aBnEQ-rxqlkDy2PcRPaPvOol_TSQCHNx1hut8OcBRo", 
    "token_type": "Bearer"
}

And basically the same for login, but changing the route to /v1/auth/login and only with email and password.

Expected result:

{
    "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsImlzcyI6Imh0dHA6Ly9sb2NhbGhvc3Q6ODAwMC92MS9hdXRoL2xvZ2luIiwiaWF0IjoxNTA2NDIyOTEwLCJleHAiOjE1MDY0MjY1MTAsIm5iZiI6MTUwNjQyMjkxMCwianRpIjoiMDlESU81aTVVcFY1RnQ5eSJ9.Zv9Fl1CMgObNdVqFYU231umygPNGhkB4SIKkKVOOGBE",
    "token_type": "bearer"    
}

References

API Wiki
API url (non oficial API. Created just for development)

I would like to work on this issue

@Pratyum I have already a Pull request for this issue

@Pratyum I have already a Pull request for this issue

Thank you so much for your work..

I would like to work on this issue

Thanks for your interest in participating .. If you are still interested just follow our repo that we will still have tasks.
Thanks Hacktoberfest

@miguejs just one thing, what you think about to move the Login.vue and Registragion.vue to src/components/auth/? just to keep it organized..

#3