跳到主要内容

Set up social login with Xiaomi

The official Logto connector for Xiaomi social sign-in.

提示:

This guide assumes you have basic understanding of Logto Connectors. For those unfamiliar, please refer to the Connectors guide to get started.

Get started

  1. Create a developer account at Xiaomi Open Platform
  2. Visit Xiaomi Account Service
  3. Create a new application if you don't have one

Configure Xiaomi OAuth application

  1. Visit Xiaomi Account Service
  2. Configure OAuth settings:
    • Open the application you want to use for login, click on "Callback URL" (if you haven't edited the callback URL, it will display as "Enabled")
    • Add authorization callback URL: ${your_logto_origin}/callback/${connector_id}
    • connector_id can be found on the top of the connector details page in Logto Console
  3. Get AppID and AppSecret from the application details page
  4. Fill in the clientId and clientSecret fields in Logto Console with the values from step 3
  5. Optional configuration:
    • skipConfirm: Whether to skip the Xiaomi authorization confirmation page when user is already logged in to Xiaomi account, defaults to false

Scopes description

By default, the connector requests the following scope:

  • 1: Read user profile

Available scopes:

Scope ValueDescriptionAPI Interface
1Get user profileuser/profile
3Get user open_iduser/openIdV2
1000Get Xiaomi router infoMi Router
1001Access all Xiaomi router infoMi Router
2001Access Xiaomi cloud calendarMi Cloud
2002Access Xiaomi cloud alarmMi Cloud
6000Use Mi Home smart home serviceMi Home
6002Add third-party devices to Mi HomeMi Home
6003Alexa control Xiaomi devicesMi Home
6004Third-party service access to Xiaomi devicesMi Home
7000Follow Yellow Pages service accountMi Cloud
11000Get Xiaomi cloud photosMi Cloud
12001Save app data to Mi CloudMi Cloud
12005Use health ECG serviceHealth
16000Get Mi Wallet passesapp/get_pass
20000Enable XiaoAI voice serviceXiaoAI
40000Enable cloud AI serviceInternal Use

Multiple scopes can be configured by separating them with spaces, e.g.: 1 3 6000.

Test Xiaomi connector

That's it. Don't forget to Enable social sign-in in the sign-in experience.

References

Xiaomi OAuth 2.0 Documentation

Xiaomi Get User Profile Documentation