When using your own OAuth credentials, you need to configure both Vectorize API credentials and platform-specific OAuth credentials.
Add the following environment variables to your Next.js application:
# Vectorize credentials
VECTORIZE_API_KEY=your_vectorize_api_token
VECTORIZE_ORGANIZATION_ID=your_organization_id
# Platform-specific OAuth credentials (example for Google Drive)
GOOGLE_OAUTH_CLIENT_ID=your_google_client_id
GOOGLE_OAUTH_CLIENT_SECRET=your_google_client_secret
GOOGLE_API_KEY=your_google_api_key
# Platform-specific OAuth credentials (example for Dropbox)
DROPBOX_APP_KEY=your_dropbox_app_key
DROPBOX_APP_SECRET=your_dropbox_app_secret- Go to the Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Drive API
- Configure the OAuth consent screen
- Create OAuth 2.0 credentials (Web application type)
- Add your redirect URI (e.g.,
https://your-app.com/api/oauth/callback) - Create an API key for the Google Picker API
- Go to the Dropbox Developer Console
- Click "Create app"
- Choose "Scoped access" for API
- Choose "Full Dropbox" or "App folder" access depending on your needs
- Name your app
- Under "OAuth 2", add your redirect URI (e.g.,
https://your-app.com/api/dropbox-callback) - Note your App Key and App Secret
const vectorizeConfig = {
authorization: process.env.VECTORIZE_API_KEY!,
organizationId: process.env.VECTORIZE_ORGANIZATION_ID!,
};
// Platform-specific validation
const googleConfig = {
clientId: process.env.GOOGLE_OAUTH_CLIENT_ID!,
clientSecret: process.env.GOOGLE_OAUTH_CLIENT_SECRET!,
apiKey: process.env.GOOGLE_API_KEY!,
};
if (!vectorizeConfig.authorization || !vectorizeConfig.organizationId) {
throw new Error('Missing required Vectorize credentials');
}
if (!googleConfig.clientId || !googleConfig.clientSecret || !googleConfig.apiKey) {
throw new Error('Missing required Google OAuth credentials');
}