GitLab OAuth2 strategy for Überauth.
Setup your Gitlab application
Add :ueberauth_gitlab
as a dependency in mix.exs
:
def deps do
[{:ueberauth_gitlab, "~> 0.1"}]
end
Add the strategy to your application:
def application do
[applications: [:ueberauth_gitab]]
end
Add Gitlab to your Uberauth configuration:
config :ueberauth, Ueberauth,
providers: [
...
gitlab: {Ueberauth.Strategy.Gitlab, []}
]
Configure the provider with the application registration credentials, setting the actual values in environment variables:
config :ueberauth, Ueberauth.Strategy.Gitlab.OAuth,
client_id: System.get_env("GITLAB_CLIENT_ID"),
client_secret: System.get_env("GITLAB_CLIENT_SECRET")
Make sure that the /auth/:provider
and /auth/:provider/callback
routes are properly configured, as explained in the Ueberauth documentation
Authentication is then available at your application's /auth/gitlab
endpoint.