FrameworksMobile
Expo
Use Integrate with Expo (React Native)
Installation
Install the Integrate SDK in your Expo project:
bun add integrate-sdkSetup
1. Server Configuration
Create a server configuration file with your OAuth credentials:
// lib/integrate.ts
import { createMCPServer, githubIntegration } from "integrate-sdk/server";
export const { client: serverClient } = createMCPServer({
apiKey: process.env.INTEGRATE_API_KEY,
integrations: [
githubIntegration({
scopes: ["repo", "user"],
}),
],
});Expo supports automatically importing the environment variables from the .env file.
You can get an API key from the Integrate Dashboard.
2. Mount the Handler
If using Expo's API Routes feature, create a catch-all route at app/api/integrate/[...segments]+api.ts:
import { serverClient } from "@/lib/integrate";
export const GET = serverClient.handler;
export const POST = serverClient.handler;Configuration
Add your OAuth credentials to your .env file:
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secretServer output
To make api routes work you need to set web.output to server in your app.json file.
{
"expo": {
"web": {
"output": "server"
}
}
}Deep Linking Setup
Configure deep linking in your app.json:
{
"expo": {
"scheme": "myapp",
"name": "My App"
}
}Usage Examples
Client-Side Authorization
The client is automatically configured when making requests to the server.
import { client } from "integrate-sdk";
await client.authorize("github");Handling Deep Links
Set up deep link handling in your app:
import * as Linking from "expo-linking";
import { useEffect } from "react";
export function OAuthCallback() {
useEffect(() => {
const handleUrl = ({ url }: { url: string }) => {
const { path, queryParams } = Linking.parse(url);
if (path === "oauth/callback") {
// Handle OAuth callback
console.log("OAuth callback:", queryParams);
}
};
Linking.addEventListener("url", handleUrl);
return () => {
Linking.removeEventListener("url", handleUrl);
};
}, []);
return null;
}