Skip to content

Jcambass/ueberauth_todoist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Überauth Todoist

Todoist OAuth2 strategy for Überauth.

Installation

  1. Setup your application at Todoist App Management.

  2. Add :ueberauth_todoist to your list of dependencies in mix.exs:

    def deps do
      [{:ueberauth_todoist, "~> 1.0"}]
    end
  3. Add Todoist to your Überauth configuration:

    config :ueberauth, Ueberauth,
      providers: [
        todoist: {Ueberauth.Strategy.Todoist, []}
      ]
  4. 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, "TODOIST_CLIENT_SECRET"}
  5. Include the Überauth plug in your controller:

    defmodule MyApp.AuthController do
      use MyApp.Web, :controller
    
      pipeline :browser do
        plug Ueberauth
        ...
       end
    end
  6. 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
  7. Your controller needs to implement callbacks to deal with Ueberauth.Auth and Ueberauth.Failure responses.

For an example implementation see the Überauth Example application.

Calling

Depending on the configured url you can initiate the request through:

/auth/todoist

Or with options:

/auth/todoist?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.

About

Todoist OAuth2 strategy for Überauth

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages