Bitly is a link management platform for creating short links, branded links, and QR codes, and for tracking how people engage with them. Marketing teams, publishers, and creators use it to manage links across campaigns and channels.
How does the integration work?
You can use the Bitly OAuth adapter in Appwrite Auth to let users sign in with their Bitly account. This fits marketing, analytics, and content tools whose users already manage their links in Bitly. The session stores Bitly's access token as providerAccessToken, so your server can call the Bitly API on the user's behalf after sign-in.
Appwrite reads the user's Bitly profile and uses the first verified email address on the account, which it marks as verified in Appwrite.
How to implement
To implement the Bitly OAuth adapter in Appwrite Auth, there are several steps you must complete:
Step 1: Register an OAuth app on Bitly
Log in to Bitly and open Developer settings. Click Register new app, then complete the registration from the link Bitly emails you. If the registration asks for redirect URIs, enter a temporary value such as https://temporary-endpoint.com/. You'll replace it with the URI from Appwrite in the next step.
Once the app is registered, Bitly assigns it a client ID and a client secret. Save both values for later use.
Step 2: Add Bitly OAuth adapter to your Appwrite project
For this step, you must create an account on Appwrite Cloud or self-host Appwrite if you haven't already. In your Appwrite project, head over to the Auth page, open the Settings tab, and click Bitly under the OAuth2 Providers section.
Paste the app's credentials into the Client ID and Client Secret fields, turn the provider on, and click Update.
Copy the Redirect URI shown in the form. On Appwrite Cloud it looks like https://<REGION>.cloud.appwrite.io/v1/account/sessions/oauth2/callback/bitly/<PROJECT_ID>, but always copy the exact value from the Console. Register it as the redirect URI of your Bitly app, replacing any temporary value.
Step 3: Test the provider
Start a session from your app with the OAuthProvider.Bitly value. With the Web SDK:
import { Client, Account, OAuthProvider } from 'appwrite';
const client = new Client() .setEndpoint('https://<REGION>.cloud.appwrite.io/v1') .setProject('<PROJECT_ID>');
const account = new Account(client);
account.createOAuth2Session({ provider: OAuthProvider.Bitly, success: 'https://example.com/success', failure: 'https://example.com/failed',});Add your app's domain as a web platform in your Appwrite project so Appwrite accepts the success and failure URLs. Follow the OAuth 2 login flow for other platforms and for server-side sign-in.
Read more about Bitly and Appwrite Auth
If you would like to learn more about Bitly and Appwrite Auth, we have some resources that you should visit:
