Manage login configurations

更新时间:
复制 MD 格式

This topic describes how to configure login authentication for your AI assistant. It covers token and OAuth 2.0 authentication for secure and efficient user identity verification and access control.

Prerequisites

You have created an AI assistant. For more information, see Create an AI assistant.

Steps

Anonymous access

This method allows users to access resources without authentication, making it suitable for open, non-sensitive content. You can use the generated URL and script directly, without additional configuration.

Token authentication

Note

Token-based authentication is recommended for the floating widget.

This method authenticates users with a valid token and is ideal for protecting resources and supporting stateless authentication.

  1. In the login configuration, select Token authentication.

  1. Call the GenerateUserSessionToken API to obtain a UserSessionToken for password-free sign-in.

  2. Add the UserSessionToken to the URL.

    • For an H5 page, append ?access_session_token=xxxxxxxxxx to the URL. Replace xxxxxxxxxx with the token from the previous step.

    • For a floating widget, add the access_session_token parameter to the script configuration.

      <script src="https://o.alicdn.com/appflow/chatbot/v1/AppflowChatSDK.js"></script>
      <script>
          window.APPFLOW_CHAT_SDK.init({
          integrateConfig: {
              integrateId: 'cit-xxxxxxxxxxxxx',
              domain: {
                  requestDomain: 'https://example.aa.com (custom domain name)'
              },
              access_session_token: 'xxxxxx (the token from the previous step)'
          }
      });
      </script>

OAuth 2.0 authentication

OAuth 2.0 is a flexible, secure authorization framework that grants third-party applications limited access to specific resources. It is ideal for environments requiring fine-grained permission control and high security.

Note

OAuth 2.0 is suitable for standalone H5 pages and is not applicable to the floating widget.

  1. In the login configuration, select OAuth 2.0 authentication.

  2. Click the Select Identity drop-down list and select Add New Identity.

  3. In the New Identity dialog box, enter an Identity Name and click Next.

    For Identity Type, select OAuth 2.0.

  4. In the Advanced Settings section, configure the OAuth 2.0 integration information and click Save. The following table describes the key fields.

    Parameter

    Description

    Example

    Client ID

    The Client ID provided by your OAuth 2.0 system for AppFlow.

    12847************

    Client Secret

    The Client Secret provided by your OAuth 2.0 system for AppFlow.

    0889*********************

    Authorization URL

    Your OAuth 2.0 system's authorization URL.

    https://**b.com/lo*/oauth/auth****

    Token URL

    The URL where AppFlow requests a token from your OAuth 2.0 system.

    https://**b.com/lo*/oauth/auth****_token

    Response type

    When AppFlow requests an authentication URL from your OAuth 2.0 system, the response_type request parameter defaults to code.

    code

    Scope

    The scope parameter for the authentication URL request that AppFlow sends to your OAuth 2.0 system is empty by default.

    repo

    Authorization Type

    The grant_type parameter in the AppFlow request to the token URL of your OAuth 2.0 system defaults to authorization_code.

    authorization_code

    Userinfo endpoint URL

    The URL of your OAuth 2.0 system's userinfo endpoint, from which AppFlow retrieves user information.

    https://api.****.com/user

    Method to request user info

    The method that AppFlow uses to request the user information URL path from your OAuth 2.0 system. The default is GET, and the available options are GET and POST.

    GET

    JSON Path for user ID

    A JSON Path expression for locating user information in the response from the userinfo endpoint.

    For example, if the response is {"userId":"12345667", "info":{"avatar":"https://xxxx.xcom/1xsa.png"},"username":"John Doe"}, you would enter $.userId, $.info.avatar, and $.username.

    $.id

    JSON Path for username

    $.login

    JSON Path for user avatar

    $.avatar_url

  5. Select the newly created identity and click Save.