Simple GAE backend for users with token auth and AngularJS frontend
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
css
js
json
messages
templates
token_auth
users
.gitignore
LICENSE
README.md
app.yaml
index.html
index.yaml
tests.py
wsgi_app.py

README.md

Areas for Improvement

  1. Tests for backend

  2. Tests for frontend

  3. Adding messaging backend, and hooking it up to the frontend

  4. Automatic token expiry after certain time

References

http://blog.abahgat.com/2013/01/07/user-authentication-with-webapp2-on-google-app-engine/

http://blog.nknj.me/token-authentication-django-and-angular

Sample curl for the backend

Create user

curl -H "Content-Type: application/json" -X POST -d '{"first_name": "Jane", "last_name": "Doe", "email":"test@test.com", "password": "test"}' "http://localhost:8080/api/v1/signup"

Sample response:

{"status": "ok", "data": Null}

Login as new user

curl -H "Content-Type: application/json" -X POST -d '{"email":"test@test.com", "password": "test"}' "http://localhost:8080/api/v1/login"

Sample response:

{"status": "ok", "data": {"auth_token": "a8a43fd309489c386b54c47fb5fbc1b8a375a3ec"}}

Returns the auth token to use while logged in.

Logout user

curl -H "Content-Type: application/json" -H "Authorization: Token a8a43fd309489c386b54c47fb5fbc1b8a375a3ec" -X GET "http://localhost:8080/api/v1/logout"

Sample response:

{"status": "ok", "data": Null}

Token cannot be re-used.

Get other users

curl -H "Content-Type: application/json" -H "Authorization: Token a8a43fd309489c386b54c47fb5fbc1b8a375a3ec" -X GET "http://localhost:8080/api/v1/users"