GithubHelp home page GithubHelp logo

aarose / spa_test Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 208 KB

Simple GAE backend for users with token auth and AngularJS frontend

Home Page: https://spa-test-993.appspot.com

License: MIT License

HTML 36.74% JavaScript 24.66% Python 33.35% CSS 5.25%

spa_test's Introduction

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":"[email protected]", "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":"[email protected]", "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"

spa_test's People

Contributors

aarose avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.