Überauth ESI
Eve Online ESI OAuth2 strategy for Überauth.
Installation
Setup your application on the ESI Developer Portal, copying the secret key and client id.
Add
:ueberauth_esito your list of dependencies inmix.exs:def deps do [{:ueberauth_esi, "~> 0.0.2"}] endAdd the strategy to your applications:
def application do [applications: [:ueberauth_esi]] endAdd ESI to your Überauth configuration:
config :ueberauth, Ueberauth, providers: [ esi: {Ueberauth.Strategy.ESI, []} ]Update your provider configuration:
config :ueberauth, Ueberauth.Strategy.ESI.OAuth, client_id: System.get_env("ESI_CLIENT_ID"), client_secret: System.get_env("ESI_CLIENT_SECRET")Include the Überauth plug in your controller:
defmodule MyApp.AuthController do use MyApp.Web, :controller pipeline :browser do plug Ueberauth ... end endCreate the request and callback routes if you haven't already:
scope "/auth", MyApp do pipe_through :browser get "/:provider", AuthController, :request get "/:provider/callback", AuthController, :callback endYou controller needs to implement callbacks to deal with
Ueberauth.AuthandUeberauth.Failureresponses.
For an example implementation see the Überauth Example application.
Calling
Depending on the configured url you can initial the request through:
/auth/esiOr with options:
/auth/esi?scope=publicDataThere is no default requested scope, copy them from the developer portal.
config :ueberauth, Ueberauth,
providers: [
esi: {Ueberauth.Strategy.ESI, [default_scope: "publicData"]}
]
It is also possible to disable the sending of the redirect_uri to ESI. This is particularly useful
when your production application sits behind a proxy that handles SSL connections. In this case,
the redirect_uri sent by Ueberauth will start with http instead of https, and if you configured
your ESI OAuth application's callback URL to use HTTPS, ESI will throw an uri_missmatch error.
To prevent Ueberauth from sending the redirect_uri, you should add the following to your configuration:
config :ueberauth, Ueberauth,
providers: [
esi: {Ueberauth.Strategy.ESI, [send_redirect_uri: false]}
]License
Please see LICENSE for licensing details.
Based on the work of ueberauth-github.