AI Platform App Integration Guide: OAuth Authorization Code and PKCE Tutorial
2026-11-18 · 原创·功能教程
AI Platform App Integration Guide: OAuth Authorization Code and PKCE Tutorial
For application developers needing authorization, tiered calls, and app-scoped usage, the AI Platform's App Integration feature is essential for building secure applications. This tutorial guides developers new to this feature on how to securely let users authorize your application.
Preparation
Before starting the integration, ensure you understand the platform's security mechanisms. The app integration uses the OAuth authorization code flow with PKCE. You need to plan the required permission scopes for your application and follow the principle of requesting only required scopes. Additionally, understand that balance and usage scopes are separate, and you must apply for them based on your actual business needs.
Operation Steps
1. Review the Documentation: Navigate to the `/docs#docs-oauth` path within the platform to obtain the latest integration specifications and parameter details.
2. Configure PKCE and S256: When initializing the authorization request, you must use the OAuth authorization code flow with PKCE. If your application operates as a public client, you must use S256 for the PKCE challenge.
3. Request Minimal Scopes: When requesting user authorization, request only required scopes. Do not ask for excessive permissions to maintain user trust and security.
4. Obtain and Use Tokens: After the user authorizes the application, you will receive the access token. Store it securely and use it for subsequent API calls and checking app-scoped usage.
Result Viewing and Permission Management
Through app integration, you can achieve tiered calls and view app-scoped usage data. Since balance and usage scopes are separate, developers must verify the authorization status of these two permission types in the backend to ensure the application has the correct permission levels when calling APIs.
Security Precautions
Throughout the integration and development process, security is paramount. Never expose ext tokens in browser code. Exposing sensitive tokens in client-side code poses severe security risks. All operations involving the ext token must be performed on the backend server.
After completing this tutorial, developers can securely implement user authorization and application integration. We encourage you to visit the platform's model directory or the corresponding tools to experience more features and further explore AI capabilities.