Skip to content

Instantly share code, notes, and snippets.

@cesarkohl
Last active May 18, 2020 13:59
Show Gist options
  • Save cesarkohl/e04ab98e1f738c510e506160a21ce1b5 to your computer and use it in GitHub Desktop.
Save cesarkohl/e04ab98e1f738c510e506160a21ce1b5 to your computer and use it in GitHub Desktop.
Rest API Login design
Now as far for implementation of your REST, these are the typical implementation that I have encountered:
GET /logout
Execute logout in the backend and return JSON for denoting the success/failure of the operation
POST /login
Submit credentials to the backend. Return success/failure. If successful, normally it will also return the session token as well as the profile information.
POST /register
Submit registration to the backend. Return success/failure. If successful, normally treated the same as successful login or you could choose to make registration as a distinct service
GET /user/xxx
Get user profile and return JSON data format for the user's profile
POST /user/xxx
// renamed to
POST /updateUser/xxx
Post updated profile information as JSON format and update the information in the backend. Return success/failure to the caller
https://stackoverflow.com/questions/7140074/restfully-design-login-or-register-resources
https://mockapi.io/projects/5ec28ed98ebdcc0016a59f4b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment