Ueberauth Heroku
Heroku OAuth2 strategy for Ueberauth.
Installation
- Setup your application on Heroku. There are three ways to register a client:
-
Add
:ueberauth_herokuto your list of dependencies inmix.exs:def deps do[{:ueberauth_heroku, "~> 0.1"}]end -
Add the strategy to your applications:
def application do[applications: [:ueberauth_heroku]]end -
Add Heroku to your Ueberauth configuration:
config :ueberauth, Ueberauth,providers: [heroku: {Ueberauth.Strategy.Heroku, []}] -
Update your provider configuration:
config :ueberauth, Ueberauth.Strategy.Heroku.OAuth,client_id: System.get_env("HEROKU_CLIENT_ID"),client_secret: System.get_env("HEROKU_CLIENT_SECRET") -
Include the Ueberauth plug in your controller:
defmodule MyApp.AuthController douse MyApp.Web, :controllerplug Ueberauth...end -
Create the request and callback routes if you haven't already:
scope "/auth", MyApp dopipe_through :browserget "/:provider", AuthController, :requestget "/:provider/callback", AuthController, :callbackend -
Your controller needs to implement callbacks to deal with
Ueberauth.AuthandUeberauth.Failureresponses.
For an example implementation see the Ueberauth Heroku example application.
Calling
Depending on the configured URL you can initial the request through:
/auth/heroku
Or with options:
/auth/heroku?scope=global
By default the requested scope is "identity" (learn
more). Scope can be
configured either explicitly as a scope query value on the request path or in
your configuration:
config :ueberauth, Ueberauth,
providers: [
heroku: {Ueberauth.Strategy.Heroku, [default_scope: "global"]}
]
License
Please see LICENSE for licensing details.