Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • pleroma pleroma
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 645
    • Issues 645
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 88
    • Merge requests 88
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PleromaPleroma
  • pleromapleroma
  • Merge requests
  • !923

OAuth consumer (sign in / sign up with external provider)

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Ivan Tashkinov requested to merge i1t/pleroma:twitter_oauth into develop Mar 11, 2019
  • Overview 37
  • Commits 25
  • Pipelines 23
  • Changes 24

Sign in / sign up via external OAuth provider.

Setup:

  • OAUTH_CONSUMER_STRATEGIES="twitter facebook google microsoft" mix deps.get

  • In config/dev.secret.exs (note extra config statement for microsoft strategy):

config :ueberauth, Ueberauth.Strategy.Twitter.OAuth,
  consumer_key: System.get_env("TWITTER_CONSUMER_KEY"),
  consumer_secret: System.get_env("TWITTER_CONSUMER_SECRET")

config :ueberauth, Ueberauth.Strategy.Facebook.OAuth,
  client_id: System.get_env("FACEBOOK_APP_ID"),
  client_secret: System.get_env("FACEBOOK_APP_SECRET"),
  redirect_uri: System.get_env("FACEBOOK_REDIRECT_URI")

config :ueberauth, Ueberauth.Strategy.Google.OAuth,
  client_id: System.get_env("GOOGLE_CLIENT_ID"),
  client_secret: System.get_env("GOOGLE_CLIENT_SECRET"),
  redirect_uri: System.get_env("GOOGLE_REDIRECT_URI")

config :ueberauth, Ueberauth.Strategy.Microsoft.OAuth,
  client_id: System.get_env("MICROSOFT_CLIENT_ID"),
  client_secret: System.get_env("MICROSOFT_CLIENT_SECRET")

config :ueberauth, Ueberauth,
  providers: [
    microsoft: {Ueberauth.Strategy.Microsoft, [callback_params: []]}
  ]
  • For Twitter, register an app at https://developer.twitter.com/en/apps, configure callback URL to https://<your_host>/oauth/twitter/callback

  • For Facebook, register an app at https://developers.facebook.com/apps, configure callback URL to https://<your_host>/oauth/facebook/callback, enable Facebook Login service at https://developers.facebook.com/apps/<app_id>/fb-login/settings/

  • For Google, register an app at https://console.developers.google.com, configure callback URL to https://<your_host>/oauth/google/callback

  • For Microsoft, register an app at https://portal.azure.com, configure callback URL to https://<your_host>/oauth/microsoft/callback

  • Start server with OAUTH_CONSUMER_STRATEGIES="twitter facebook google microsoft" TWITTER_CONSUMER_KEY="..." TWITTER_CONSUMER_SECRET="..." FACEBOOK_APP_ID="..." FACEBOOK_APP_SECRET="..." FACEBOOK_REDIRECT_URI="..." GOOGLE_CLIENT_ID="..." GOOGLE_CLIENT_SECRET="..." GOOGLE_REDIRECT_URI="..." MICROSOFT_CLIENT_ID="..." MICROSOFT_CLIENT_SECRET="..." mix phx.server

  • https://<your_host>/web/ will have "Sign in with ..." option for each strategy listed in OAUTH_CONSUMER_STRATEGIES.

Edited Apr 05, 2019 by Ivan Tashkinov
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: twitter_oauth