danschultzer
OAuth 2.0 provider for Elixir and Phoenix
In short
Plug n’ play OAuth 2.0 provider library. Just set up a resource owner schema with Ecto (your user schema), install the dependency and run the install task. That’s it! 
ExOauth2Provider
PhoenixOauth2Provider
Background
This is my first full project in Elixir. The reason for building these hex libraries was that I needed a flexible plug n’ play OAuth 2.0 provider for a Phoenix project I’m working on. The other options I found didn’t cut it for me, and I was looking for something akin to Doorkeeper for Rails. Basically a no brainer library, that I can adjust after getting it up and running.
Use case
I wrote a blog post on how you can create a versioned API using OAuth 2.0 access tokens in minutes using this library: https://dreamconception.com/tech/phoenix-full-fledged-api-in-five-minutes/
I hope this can be useful for some of you. Please feel free to help improve the libraries with suggestions or PR’s!
Most Liked
danschultzer
I’ve made a few updates since I wrote this post. Now there’s added support for UUID (or custom primary key type), and works with Phoenix 1.3. Blog post has been updated too. All feedback is welcome 
danschultzer
Just updated the tutorial and demo app too:
https://dreamconception.com/tech/phoenix-full-fledged-api-in-five-minutes/
https://github.com/danschultzer/phoenix_ex_oauth2_provider_demo
Happy coding!
danschultzer
Finally got around to rewriting these libraries. With Pow I got a much better idea how these libraries should work.
It will be much easier to contribute to them moving forward
It was a major rewrite so there are probably a lot of things that can be refactored, and I have overlooked. Any help would be much appreciated!
ExOauth2Provider v0.5.0 changes
- Schema modules are now generated (with
mix ex_oauth2_provider.gen.schemas). Now all configuration (e.g. binary id) are done on the individual schema modules. Previously there were issues if e.g. some app environment was not available during compilation, and configuration wasn’t particularly explicit. - Configuration are primarily passed through the method calls with fallback to app environment.
- Ecto 3.0 support.
PhoenixOauth2Provider 0.5.0
- Templates are now built in so you can get started without generating any views/templates!
- Phoenix 1.4 support.
cmush
Thanks @danschultzer for the awesome work on the Oauth2.0 Provider. It’s been very helpful.
I was just wondering if an update for phoenix_oauth2_provider is on the way since the library currently depends on {:ex_oauth2_provider, "~> 0.5.1"} while the latest version of that library is {:ex_oauth2_provider, "~> 0.5.6"} which I imagine brings a bunch of improvements.
iarekk
As is the project, I assume, last commit 4 years ago: GitHub - danschultzer/phoenix_oauth2_provider: Get an OAuth 2 provider running in your phoenix with controllers, views and models in just two minutes
EDIT: I missed the fresh project from the OP: GitHub - danschultzer/ex_oauth2_provider: Making OAuth 2 provider and authentication with http bearer as simple as possible for Elixir and Phoenix apps








