Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hachreak/oauth2_mongopool
A implementation of an OAuth2 backend with persistence on MongoDB made with mongopool.
https://github.com/hachreak/oauth2_mongopool
erlang erlang-libraries erlang-library mongodb oauth2
Last synced: 14 days ago
JSON representation
A implementation of an OAuth2 backend with persistence on MongoDB made with mongopool.
- Host: GitHub
- URL: https://github.com/hachreak/oauth2_mongopool
- Owner: hachreak
- License: gpl-2.0
- Created: 2015-12-13T20:56:13.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-31T16:13:35.000Z (almost 7 years ago)
- Last Synced: 2024-11-06T13:00:44.633Z (2 months ago)
- Topics: erlang, erlang-libraries, erlang-library, mongodb, oauth2
- Language: Erlang
- Size: 2.5 MB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
oauth2_mongopool
=====[![Build Status](https://travis-ci.org/hachreak/oauth2_mongopool.svg?branch=master)](https://travis-ci.org/hachreak/oauth2_mongopool)
A implementation of an [OAuth2](https://github.com/kivra/oauth2) backend with
persistence on `MongoDB` made with
[mongopool](https://github.com/hachreak/mongopool).Configuration
-------------```erlang
[
{mongopool, [
{pools, [
{mypool, [
{size, 10},
{max_overflow, 30}
], [
{database, <<"mydb">>},
{hostname, dbserver},
{login, "myuser"},
{password, "mypassword"},
{w_mode, safe}
]}
]}
]},
{oauth2_mongopool, [
{pool, mypool}
]},
{oauth2, [
{backend, oauth2_backend_mongopool}
]}
]
```Usage
-----After you configure [oauth2](https://github.com/kivra/oauth2) and
[mongopool](https://github.com/hachreak/mongopool) as wrote before, you can
start the backend to ensure that `mongopool` is started.```erlang
application:ensure_all_started(oauth2_mongopool).
{ok, AppCtx} = oauth2_mongopool:init().
```The `AppCtx` is the application context used when you call `oauth2` functions.
E.g. to verify the access token:
```erlang
case oauth2:verify_access_token(<>, AppCtx) of
{ok, } -> true;
{error, _ErrType} -> false
end
```Build
-----$ utils/rebar3 compile
Tests
-----$ ./utils/rebar3 eunit