Ueberauth.Strategy.FreeAgent

FreeAgent OAuth2 strategy for Überauth.

Configuration

Add freeagent to your Überauth configuration:

config :ueberauth, Ueberauth,
  providers: [
    freeagent: {Ueberauth.Strategy.FreeAgent, []}
  ]

Update your provider configuration, setting your client_id and client_secret:

config :ueberauth, Ueberauth.Strategy.FreeAgent.OAuth,
  client_id: System.get_env("FREEAGENT_CLIENT_ID"),
  client_secret: System.get_env("FREEAGENT_CLIENT_SECRET")

IMPORTANT: To use the FreeAgent sandbox API, set sandbox to true for the :ueberauth_freeagent application:

config :ueberauth_freeagent,
  sandbox: true

This will automatically configure the correct URLs.

OAuth2 Flow

For information on how to configure Phoenix to use this strategy, see the README

Summary

Functions

Includes the credentials from the FreeAgent response

Stores the raw information (including the token) obtained from the freeagent callback

Cleans up the private area of the connection used for passing the raw freeagent response around during the callback

Handles the initial redirect to the FreeAgent authentication page

Fetches the fields to populate the info section of the Ueberauth.Auth struct

Fetches the uid field from the FreeAgent response. This defaults to the option uid_field which in-turn defaults to email

Functions

auth(conn)
credentials(conn)

Includes the credentials from the FreeAgent response.

default_options()
extra(conn)

Stores the raw information (including the token) obtained from the freeagent callback.

handle_cleanup!(conn)

Cleans up the private area of the connection used for passing the raw freeagent response around during the callback.

handle_request!(conn)

Handles the initial redirect to the FreeAgent authentication page.

You can include a state param that FreeAgent will return to you.

info(conn)

Fetches the fields to populate the info section of the Ueberauth.Auth struct.

uid(conn)

Fetches the uid field from the FreeAgent response. This defaults to the option uid_field which in-turn defaults to email