Garmin Connect strategy for Überauth.
-
Setup your application at Garmin Developers.
-
Add
:ueberauth_garmin_connect
to your list of dependencies inmix.exs
:def deps do [ {:ueberauth_garmin_connect, git: "git://github.com/tiltify/ueberauth_garmin_connect.git"} ] end
-
Add Garmin to your Überauth configuration:
config :ueberauth, Ueberauth, providers: [ garmin_connect: {Ueberauth.Strategy.GarminConnect, []} ]
-
Update your provider configuration:
config :ueberauth, Ueberauth.Strategy.GarminConnect.OAuth, consumer_key: System.get_env("GARMIN_CONNECT_CONSUMER_KEY"), consumer_secret: System.get_env("GARMIN_CONNECT_CONSUMER_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
-
Your controller needs to implement callbacks to deal with
Ueberauth.Auth
andUeberauth.Failure
responses.
For an example implementation see the Überauth Example application.
Depending on the configured url you can initiate the request through:
/auth/garmin_connect
This library is released under the MIT License. See the LICENSE file for further details.