View Source Überauth Notion
Notion OAuth2 strategy for Überauth.
installation
Installation
Setup your application by following the following guide.
Add
:ueberauth_notion
to your list of dependencies inmix.exs
:def deps do [ {:ueberauth_notion, "~> 0.1.1"} ] end
Add Notion to your Überauth configuration:
config :ueberauth, Ueberauth, providers: [ notion: {Ueberauth.Strategy.Notion, []} ]
Update your provider configuration:
config :ueberauth, Ueberauth.Strategy.Notion.OAuth, client_id: System.get_env("NOTION_CLIENT_ID"), client_secret: System.get_env("NOTION_CLIENT_SECRET"), redirect_uri: System.get_env("NOTION_REDIRECT_URI")
Or, to read the client credentials at runtime:
config :ueberauth, Ueberauth.Strategy.Github.OAuth, client_id: {:system, "NOTION_CLIENT_ID"}, client_secret: {:system, "NOTION_CLIENT_SECRET"}, redirect_uri: {:system, "NOTION_REDIRECT_URI"}
Include the Überauth plug in your router:
defmodule MyApp.Router do use MyApp.Web, :router pipeline :browser do plug Ueberauth ... end 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.
calling
Calling
Depending on the configured url you can initiate the request through:
/auth/notion