UChat Official

Introduction

This comprehensive overview explains the Authorization section of the mini app dashboard, guiding users through its three main components: Input Tab, OAuth (O) Type, and Request Section.

The goal is to clarify how to configure global variables, set up OAuth authentication, and manage API requests efficiently.

This summary emphasizes key features, step-by-step procedures, and best practices, providing a clear understanding for users aiming to optimize their mini app integrations.

Detailed Breakdown of the Authorization Section

1. Input Tab: Managing Global Variables

The Input Tab is essential for defining global variables that your mini app will utilize. These variables often include API tokens, keys, or other credentials necessary for API interactions.

How to Create a Global Variable:

  • Click on "ADD" to initiate the creation process.

  • Add Item: Click on "Add Item" to define a new variable.

  • Name the Variable: Assign a unique name (e.g., API token, token).

  • Select Input Type:

    • String

    • Text

    • Number

    • Checkbox

  • Set Mandatory Status:

    • Toggle "Required" to make the variable mandatory before proceeding.

  • Choose Storage Field:

    • Select the app field where the value will be stored (e.g., API key).

    • You can create custom fields if needed.

  • Add Description or Placeholder:

    • Provide helpful info like "Enter your API token" or placeholder text such as Xyz.

  • Set Character Limits (optional).

  • Save the Variable:

    • Click "Save" to finalize.

    • The variable will then be requested during mini app installation.

Summary Table: Input Tab Features

Feature

Description

Add Variable

Initiates creation of a new global variable

Name

Unique identifier for the variable

Input Type

String, Text, Number, Checkbox

Required

Mandatory before proceeding

Storage Field

App field where value is saved

Description/Placeholder

User guidance text

Character Limit

Max length for input

2. OAuth (O) Type: Configuring Authentication

The OAuth (O) Type supports two main authentication methods:

Type

Description

API Key

Static token or API key stored as a global variable, used for all requests

OAuth 2.0

Dynamic, multi-step authentication process involving redirect URLs, client IDs, secrets, and tokens

API Key Method:

  • Insert a static token into the global variables.

  • Use this token for all API requests, simplifying authentication.

OAuth 2.0 Method:

  • Setup involves multiple steps:

    • Redirect URL: Embed this URL into the third-party app to receive data.

    • Client ID & Secret: Provided by the third-party platform.

    • Authorize URL & Token Endpoints: From API documentation.

    • Configure Fields:

      • Default fields are pre-filled for ease.

      • Scopes: Add specific permissions required by the platform.

  • Connecting the OAuth:

    • Click "Sign into Connect" to initiate the OAuth flow.

    • The process will authorize and connect your app to the third-party platform.

  • Note: When using OAuth, custom domains are not supported; only the base platform domain appears.

Important Considerations:

  • Ensure correct URLs and credentials are used.

  • Scopes must match platform requirements.

  • The OAuth process automatically handles token refreshes.

3. Request Section: Managing API Requests

The Request Section allows setting up API requests that execute on specific actions within the mini app.

Purpose:

  • Automate token generation or renewal.

  • Perform API calls that depend on dynamic tokens or credentials.

How to Configure:

  • Click "Add Request".

  • Define the API endpoint and request method (GET, POST, etc.).

  • Set up request parameters and headers as needed.

  • Token Management:

    • Use this request to generate or refresh tokens.

    • Save the token into a designated field.

  • The request executes automatically each time the associated action occurs, ensuring tokens are up-to-date.

Use Case Example:

  • Generate an API token before making requests.

  • Store the token in a variable.

  • Use the stored token in subsequent API calls.

Summary

In summary, the Authorization section of the mini app dashboard provides a robust framework for managing credentials and authentication flows. The Input Tab simplifies global variable management, enabling seamless integration of API keys and tokens. The OAuth (O) Type offers flexible, secure authentication options suitable for various platforms, supporting both static API keys and dynamic OAuth flows. The Request Section automates token renewal and API interactions, ensuring your mini app maintains secure and efficient communication with external services.

By mastering these components, users can streamline their API integrations, enhance security, and ensure reliable data exchange within their mini apps. Proper configuration of these settings is crucial for smooth operation, compliance with platform requirements, and optimized user experience.