Überauth Todoist
Todoist OAuth2 strategy for Überauth.
Installation
Setup your application at Todoist App Management.
Add
:ueberauth_todoistto your list of dependencies inmix.exs:def deps do [{:ueberauth_todoist, "~> 1.0"}] endAdd Todoist to your Überauth configuration:
config :ueberauth, Ueberauth, providers: [ todoist: {Ueberauth.Strategy.Todoist, []} ]Update your provider configuration:
config :ueberauth, Ueberauth.Strategy.Todoist.OAuth, client_id: System.get_env("TODOIST_CLIENT_ID"), client_secret: System.get_env("TODOIST_CLIENT_SECRET")Or, to read the client credentials at runtime:
config :ueberauth, Ueberauth.Strategy.Todoist.OAuth, client_id: {:system, "TODOIST_CLIENT_ID"}, client_secret: {:system, "To_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 endYour 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 initiate the request through:
/auth/todoistOr with options:
/auth/toddoist?scope=data:read
Scope can be configured either explicitly as a scope query value on the request path or in your configuration:
config :ueberauth, Ueberauth,
providers: [
github: {Ueberauth.Strategy.Todoist, [default_scope: "data:read"]}
]License
Please see LICENSE for licensing details.