View Source ueberauth_duo
Cisco Duo OAuth2 strategy for Überauth.
Installation
Set up your Duo OICD application by following these instructions.
Add
:ueberauth_duo
to your list of dependencies inmix.exs
:def deps do [ {:ueberauth_duo, "~> 1.0"} ] end
Ensure
ueberauth_duo
is started before your application:def application do [ extra_applications: [:ueberauth_duo] ] end
Add Duo to your Überauth configuration:
config :ueberauth, Ueberauth, providers: [ duo: {Ueberauth.Strategy.Duo, []} ],
Update your provider configuration:
config :ueberauth, Ueberauth.Strategy.Duo.OAuth, site: System.get_env("DUO_SITE"), client_id: System.get_env("DUO_CLIENT_ID"), client_secret: System.get_env("DUO_CLIENT_SECRET")
Include the Überauth plug in your controller:
defmodule MyApp.AuthController do use MyApp.Web, :controller plug Ueberauth ... end
Create 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 end
You controller needs to implement callbacks to deal with Ueberauth.Auth and Ueberauth.Failure responses.
For an example implementation see the Überauth Example application.
Thanks!
This library is basically a copy and paste of the Okta and Microsoft Ueberauth strategies, and would not be possible without them. Thank you to the good people at Appcues and to Stuart Welham for all your hard work.
Learn about OAuth2
OAuth2 explained with cute shapes
Copyright and License
Copyright (c) 2023 Peter Lacey
This library is released under the MIT License. See the LICENSE.md file for further details.