ElixirAuthGithub v1.0.0 ElixirAuthGithub View Source

ElixirAuthGithub is an Elixir package that handles all your GitHub OAuth needs so you can add "Sign in with GitHub" to any Elixir/Phoenix App.

For all setup details, please see: https://github.com/dwyl/elixir-auth-github

Link to this section Summary

Functions

When called with a valid OAuth callback code, github_auth/1 makes a number of authentication requests to GitHub and returns a tuple with :ok and a map with GitHub user details and an access_token.

login_url/0 returns a String URL to be used as the initial OAuth redirect.

Identical to login_url/0 except with an additional state property appended to the URL.

login_url_with_scope/1 takes a list of GitHub auth scopes to add to the url. Returns String URL.

Link to this section Functions

When called with a valid OAuth callback code, github_auth/1 makes a number of authentication requests to GitHub and returns a tuple with :ok and a map with GitHub user details and an access_token.

Bad authentication codes will return a tuple with :error and an error map.

login_url/0 returns a String URL to be used as the initial OAuth redirect.

Requires GITHUB_CLIENT_ID environment variable to be set. See step 2 of setup instructions.

Identical to login_url/0 except with an additional state property appended to the URL.

Link to this function

login_url_with_scope(scopes)

View Source

login_url_with_scope/1 takes a list of GitHub auth scopes to add to the url. Returns String URL.