- Redirect a user through an OAuth-style authorization flow
- Receive a
connection_id - Use that
connection_idto make unified API calls via BundleUp
Prerequisites
Before you begin, make sure you have:- A BundleUp account
- A BundleUp API key (server-side)
- Your BundleUp Client ID (used for authorization redirects)
- An Integration ID for the service you want to connect (for example,
github) - Node.js 18+ installed
You can find your API key, Client ID, and Integration IDs in the BundleUp dashboard.
Step 1: Create a new Next.js app
If you don’t already have a Next.js project, start by creating one. BundleUp works with both the App Router and Pages Router, but this guide uses the App Router. Run one of the following commands to scaffold a new app:Step 2: Install @bundleup/sdk
Next, install the official BundleUp SDK. This SDK is used server-side to make authenticated requests to third-party APIs using a connection_id.
Step 3: Configure environment variables
BundleUp uses two types of credentials:- A server-side API key for making API requests
- A client-safe Client ID for starting the authorization flow
.env.local file in your project root and add the following:
.env.local
Step 4: Create the authorization link
In this step, you’ll create a simple page that sends the user to BundleUp’s authorization endpoint. This URL:- Identifies your app (
client_id) - Specifies which integration to connect (
integration_id) - Defines where the user should be redirected after authorization (
redirect_uri)
app/page.tsx
Step 5: Handle the callback and fetch data
After the user authorizes the integration, BundleUp redirects them back to your app with aconnection_id.
This connection_id represents:
- A specific user
- A specific integration
- Securely stored credentials managed by BundleUp
connection_id is stable and reusable. You should store it and reuse it for future requests instead of re-authorizing the user.
Create a callback page (for example, app/callback/page.tsx) and use the SDK to fetch data:
app/callback/page.tsx
- BundleUp handles authentication, token refresh, and API differences
- You make a single, normalized API call
Step 6: Run your application
Start your Next.js development server:http://localhost:3000 and click “Connect GitHub”. You’ll be redirected to GitHub to authorize the connection. After authorization, you’ll be redirected back and can fetch your repositories.
What’s next?
- Store the
connection_idin your database - Use it across API routes, server actions, or background jobs
- Add support for additional integrations with zero auth changes

