PhoenixOauth2Provider v0.4.0 PhoenixOauth2Provider.Router View Source

Handles routing for PhoenixOauth2Provider.

Usage

Configure lib/my_project_web/router.ex the following way:

defmodule MyProject.Router do
  use MyProjectWeb, :router
  use PhoenixOauth2Provider.Router

  pipeline :oauth_public do
    plug :put_secure_browser_headers
  end

  pipeline :protected do
    # Require user authentication
  end

  scope "/", MyProjectWeb do
    pipe_through :oauth_public
    oauth_routes :public
  end

  scope "/", MyProjectWeb do
    pipe_through :protected
    oauth_routes :protected
  end

  ...
end

Link to this section Summary

Functions

PhoenixOauth2Provider router macro. Use this macro to define the PhoenixOauth2Provider routes

Link to this section Functions

Link to this macro oauth_routes(mode, options \\ %{}) View Source (macro)

PhoenixOauth2Provider router macro. Use this macro to define the PhoenixOauth2Provider routes.

Examples:

# Routes that are public with no CSRF protection
scope "/" do
  pipe_through :public
  oauth_routes :public
end

# Routes requires authentication
scope "/" do
  pipe_through :protected
  oauth_routes :protected
end