SWPP / cid-backend

μBot backend based on Django
MIT License
0 stars 2 forks source link

Implemented sign-up, withdraw and token-based sign-in/out #3

Closed lameinthebox closed 6 years ago

lameinthebox commented 6 years ago

I've implemented simple sign-in/out view based on token. Here, user detail view is allowed only to that exact user. Thus, GET without authorization returns an error. screenshot from 2018-10-08 07-05-22

We can get signed in at /auth/signin/ by http POST request with payload that consists of valid username and password. This returns an authorization token. screenshot from 2018-10-08 07-17-51

Now, we can authorize our requests by including the token in request header. screenshot from 2018-10-08 07-11-49

Of course, using some random string as a token does not work. screenshot from 2018-10-08 07-12-54

We can sign-out at /auth/signout/ by http POST request with Authorization token included in header. screenshot from 2018-10-08 07-14-02

This removes the token from the db, so that no more authorization is possible. screenshot from 2018-10-08 07-16-41

We can sign-up at /auth/signup/ by http POST request with valid username and password given as payload. screenshot from 2018-10-08 15-27-14

We can withdraw at /auth/withdraw/ by http POST request with valid username and password given as payload. screenshot from 2018-10-08 16-15-50