Skip to content

Latest commit

 

History

History
50 lines (34 loc) · 946 Bytes

README.md

File metadata and controls

50 lines (34 loc) · 946 Bytes

couch_jwt_token

Request handler to generate JSON Web Token after user authentication using CouchDB authentication database.

Token generated by this handler can be parsed by couch_jwt_auth.

Requirements

  • Couchdb 1.6.1
  • couch_jwt_auth

Installation (taken from couch_jwt_auth)

For compiling and installing the plugin, see couch_jwt_auth

Note:

On Ubuntu, the plugins directory is: /usr/lib/couchdb/plugins

Couchdb default.ini config:

[httpd]
vhost_global_handlers = ... , _token
[httpd_global_handlers]
_token = {couch_jwt_token, handle_session_req}

Test with Curl

curl --data "name=USERNAME&password=PASSWORD" http://localhost:5984/_token

Response

HTTP/1.1 200 OK
{"ok":true,"id_token":"JWT_TOKEN"}

TODO:

  • tests
  • store tokens in DB
  • refresh token

Licence:

Apache v2.0 license.