Bitbucket Social Login with Magic
Bitbucket Social Login with Magic
#Overview
You can allow your users to sign up & log in to your web app with their Bitbucket account.
#Usage
#Prerequisites
- You will need a Bitbucket 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
#Bitbucket Setup (v1 extension)
After installing the OAuth extension, you can now enable Bitbucket Login for your Magic app:
- Go to your Magic Dashboard
- Select the Magic app for which you’d like to enable bitbucket Login, or create a new app
- Navigate to Authentication -> Social Logins from the sidebar
- Click the toggle for Bitbucket
- Copy the Redirect URI field from your Magic Dashboard
- Go to Bitbucket App Dashboard. In the top right corner, click the profile avatar and select Workspace settings. Alternatively you can click on the profile avatar in the top right and choose All workspaces to open an entire list where you can then select Manage on the workspace you need.
- On the left sidebar, scroll down to the Apps and Features header and click OAuth consumers, then click the Add consumer button
- Add the Name along with the Redirect URI you obtained from your Magic Dashboard into the Callback URL and click Save
- Please make sure at least to grant Read permission in the account section. Otherwise, authentication will not complete.
- Obtain the "Key" and "Secret"
- Return to your Magic Dashboard and input the Key and Secret for your bitbucket OAuth app
- In Magic Dashboard, click “Save” – Done!
#Bitbucket Setup (v2 extension)
- Follow above steps, but disregard Magic's Redirect URI in step 5
- In step 8, paste the Redirect URI you are passing in as the redirectURI argument to the loginWithRedirect method
Javascript
01await magic.oauth2.loginWithRedirect({
02 provider: 'bitbucket',
03 redirectURI: 'https://your-app.com/your/oauth/callback', // <== whitelist this with Bitbucket
04});