Coder Social home page Coder Social logo

eve-tokenauth's Introduction

#Eve-TokenAuth

Introduction

Eve-TokenAuth is a way to add an auth layer on top of your existing eve app.

It is meant to be compatible with the awesome Satellizer project:

Satellizer Github

It follows this example: Satellizer Python Server Example

Usage

Running the Example

To run the example, you will need to have a mongodb setup and change the settings.py to reflect your mongo server's settings. A default.settings.py file is included.

It may require creating a user for the db as well:

db.addUser( { user: "user", pwd: "user", roles: [ "readWrite" ] } )

Running the Tests

The tests currently setup a db according to the settings in testsettings.py. You will need to have a mongo server running to run the tests.

Using with your Eve App

This needs better docs. The gist is you:

  1. Wrap your Eve with the Eve-TokenAuth Constructor:

    apiapp = Eve() evewta = EveWithTokenAuth(apiapp)

    This will create an accounts and a token endpoint.

  2. Add Authentication to your Resource Configuration

    from eve_tokenauth.auth.token import TokenAuthentication ... books = { 'authentication': TokenAuthentication(), ... }

  3. Launch your app

  4. Register an account

    curl -X POST -H "Content-Type: application/json" -d '{ "first_name"="Navin R.", "last_name"="Johnson", "email"="[email protected]", "password"="password", "is_email_confirmed"=true }' http://localhost:5000/api/v1/accounts

  5. Get a token with that account

    curl -X GET -H "Content-Type: application/json" -u "[email protected]:password" http://localhost:5000/api/v1/tokens

  6. Use that token to hit your endpoint

    curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer TokenTokenTokenTokenToken..." http://localhost:5000/api/v1/books

Roadmap

  • Rate Limit / Secure Registration Endpoint
  • Store OAuth properly
  • Document lol

eve-tokenauth's People

Contributors

kingtimm avatar

Watchers

 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.