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!
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.
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
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!
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.
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.
Hi, I have an app that uses Pow for authentication, and I have set up ExOauth2Provider - it works great!
I have a security concern, though. The OAuth tokens and refresh tokens are stored as plain text in the database. That seems risky; if the DB gets compromised, then the attacker gets the credentials.
Shouldn’t the tokens and refresh tokens be encrypted at rest? What’s your approach to this?
Maybe using cloak_ecto | Hex would help here, but we’d have to tweak ExOauth2Provider to get the tokens by hash?