DeveloperDeveloper
  • Standard Solutions
  • Cam Solutions
  • Native SDKs
  • App Gallery
  • Game Engine Plugins
Forum
Projects Library
Dev Discord
  • Standard Solutions
  • Cam Solutions
  • Native SDKs
  • App Gallery
  • Game Engine Plugins
Forum
Projects Library
Dev Discord
  • App Gallery (with Lovense Remote)
    • Get Started
    • Development
    • Deploy
  • Basic API
    • Life Cycle
  • Platform API
    • App Info
      • AppBaseInfo
    • Toy
      • Toy Info
      • Command
      • Feedback Mode
    • Device
      • Accelerometer
      • Screen Orientation
      • Shake
      • Vibrate
    • File System
      • Save Image
  • Open API
    • User Authorization
      • Client API
      • Server API
  • Error Code
  • User Manager
    • getAuthCode
    • authorize
    • getAuthSetting
    • AuthSetting
Got Stuck?
Forum for Lovense Developers
Support
Document Feedback

Client API

User Manager

Use appGallery.getUserManager() to get the globally unique user manager instance.

getAuthCode

  • Description

    After the user logs into the host app (Lovense Remote App), call this interface to obtain user information authorization and obtain an authorization code (authCode).

  • Parameters

    AttributeTypeDefaultRequiredIntroduction
    scopeStringYesAuthentication Type,
    authBase: Silent authorization, no authorization pop-up will appear;
    authUser: User authorization, an authorization pop-up will appear
    successfunctionNoCallback function for successful API call
    failfunctionNoCallback function for failed API call

    Success callback function will receive an object with the following attributes:

    AttributeTypeIntroduction
    authCodestringAuthorization code

    Fail callback function will receive an object with the following attributes:

    AttributeTypeIntroduction
    codestringError code
    msgstringError message
  • Example

    // Get user manager instance
    const userManager = appGallery.getUserManager();
    
    // User authorization
    userManager.getAuthCode({
      scope: "authUser", // Authorization type
      success(res) {
        console.log(res.authCode) // Print the obtained authorization code
      },
      fail(err) {
        console.error(err.code) // Print error code
        console.error(err.msg) // Print error message
      },
    });
    

authorize

  • Description

    Initiate authorization requests to users in advance. Immediately after the call, a pop-up asks if the user agrees to authorize the mini-app to use a function or get some data from the user, but does not actually call the corresponding interface. If the user has previously agreed to the authorization, there will be no pop-up window, directly return success.

  • Parameters

    AttributeTypeDefaultRequiredIntroduction
    scopeStringYesNeed to get permission scope: scope.writePhotosAlbum: save the image to system album
    successfunctionNoCallback function for successful API call
    failfunctionNoCallback function for failed API call

    Success callback function will receive an object with the following attributes:

    AttributeTypeIntroduction
    codestringSuccess code

    Fail callback function will receive an object with the following attributes:

    AttributeTypeIntroduction
    codestringError code
    msgstringError message
  • Example

    // Get user manager instance
    const userManager = appGallery.getUserManager();
    
    userManager.authorize({
      scope: 'scope.writePhotosAlbum',
      success(res) {
        console.log(res.code)
      },
      fail(err) {
        console.error(err.code)
        console.error(err.msg)
      }
    });
    

getAuthSetting

  • Description

    User's current authorize settings results.

  • Parameters

    AttributeTypeDefaultRequiredIntroduction
    successfunctionNoCallback function for successful API call
    failfunctionNoCallback function for failed API call

    Success callback function will receive an object with the following attributes:

    AttributeTypeIntroduction
    authSettingAuthSettingUser's Current Authorize Settings Results

    Fail callback function will receive an object with the following attributes:

    AttributeTypeIntroduction
    codestringError code
    msgstringError message
  • Example

    // Get user manager instance
    const userManager = appGallery.getUserManager();
    
    userManager.getAuthSetting({
      success(res) {
        console.log(res.authSetting)
        // res.authSetting = {
        //   "scope.writePhotosAlbum": true
        // }
      },
      fail(err) {
        console.error(err.code)
        console.error(err.msg)
      },
    });
    

AuthSetting

When using getAuthSetting to get user's current authorize settings results, will get authSetting data.

For each item in a authSetting are as follows:

AttributeTypeIntroduction
scope.writePhotosAlbumbooleanAuthorize Save to Album
Last Updated:
Next
Server API
Explore our Forum or Support to get more inspiration or solve your problems.
Discord Channel
It is an online real-time channel where you can communicate directly with our official administrators or many excellent developers.
Forum
It is a place for Lovense developers to communicate, where you can find solutions to problems or get inspired for your projects.
Support
Find documents and tutorials that may be helpful to you.