my.getAuthCode

Get authentication code.

Sample Code

copy
my.getAuthCode({
  scopes: 'auth_user',
  success: (res) => {
    my.alert({
      content: res.authCode,
    });
  },
});

Parameters

NameTypeMandatoryDescription
scopesString/ArrayNThe scope of auth, there are two types: auth_base, 
auth_user, by default, its value is auth_base

Success Callback Function

The incoming parameter is of the Object type with the following attributes:

FieldTypeMandatoryDescription
authCodeStringYAuth code
authErrorScopesKey-valueYThe scope that failed to grant auth, key is the scope and value is the error
authSuccessScopesArrayYThe scope that succeed to grant auth