We've updated our Terms of Service. By continuing to use our services, you agree to the updated Terms.

GitLab Social Login with Magic

GitLab Social Login with Magic

#Overview

You can allow your users to sign up & login into your web application with their GitLab account.

#Usage

#Prerequisites

note

Magic SDK offers two OAuth extensions: v1 and v2. For web applications, it is recommended to use v2, while v1 should be used for mobile applications.

#GitLab Setup (v1 extension)

After installing the OAuth extension, you can now enable GitLab Login for your Magic app:

  1. Go to your Magic Dashboard
  2. Select the Magic app for which you’d like to enable GitLab Login, or create a new app
  3. Navigate to Social Login from the sidebar
  4. Click the toggle for GitLab
  5. Copy the Redirect URI field from your Magic Dashboard
  6. Go to GitLab App Dashboard.
  7. On the left sidebar, select your avatar
  8. Select Edit Profile
  9. On the left sidebar, select Applications
  10. Select Add new application
  11. In the application form, enter a Name (arbitrary), and make sure to paste the Redirect URI from step 5, into the input field
  12. Make sure to tick openid, profile, email in the Scopes
  13. When you click Save application you are provided with the application ID and the application secret which you can then use with your application that connects to GitLab
  14. Return to your Magic Dashboard and input the Application Id and Secret for your GitLab OAuth app
  15. In Magic Dashboard, click “Save” – Done!

#GitLab Setup (v2 extension)

  • Follow above steps, but disregard Magic's Redirect URI in step 5
  • In step 11, paste the Redirect URI you are passing in as the redirectURI argument to the loginWithRedirect method
Javascript
01await magic.oauth2.loginWithRedirect({
02  provider: 'gitlab',
03  redirectURI: 'https://your-app.com/your/oauth/callback', // <== whitelist this with Gitlab
04});

#Resources