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
- You will need a GitLab account
- You will need to have the Magic SDK installed into your web app
- You will need to have the Magic SDK - OAuth Extension installed into your web app
#GitLab Setup (v1 extension)
After installing the OAuth extension, you can now enable GitLab Login for your Magic app:
- Go to your Magic Dashboard
- Select the Magic app for which you’d like to enable GitLab Login, or create a new app
- Navigate to Social Login from the sidebar
- Click the toggle for GitLab
- Copy the Redirect URI field from your Magic Dashboard
- Go to GitLab App Dashboard.
- On the left sidebar, select your avatar
- Select Edit Profile
- On the left sidebar, select Applications
- Select Add new application
- In the application form, enter a Name (arbitrary), and make sure to paste the Redirect URI from step 5, into the input field
- Make sure to tick openid, profile, email in the Scopes
- 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
- Return to your Magic Dashboard and input the Application Id and Secret for your GitLab OAuth app
- 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
01await magic.oauth2.loginWithRedirect({
02 provider: 'gitlab',
03 redirectURI: 'https://your-app.com/your/oauth/callback', // <== whitelist this with Gitlab
04});