Login and Authorization
These APIs manage the user's login status and data permissions.
TTMinis.login(callback)
Engages silent login initiating the login flow and obtaining the login authorization code. This attempts to log the user in and get their basic access credentials (code) without showing an authorization screen. Used for IAP and basic identification.
Callback parameters
Field | Type | Description |
|
| The authorization code returned by login. |
|
| Returned on failure. See error structure. |
Example
TTMinis.login(function (res) {
if (res.error) {
console.error('login failed', res.error);
return;
}
console.log('login code:', res.authResponse.code);
});TTMinis.authorize(callback, options)
Requests user authorization. Engages the explicit authorization process, which prompts the user with an authorization screen to grant your app specific data permissions. This is needed for data beyond basic ID, like username and avatar.
By default, calling TTMinis attempts to verify the user's basic permissions (avatar, display name, open ID, and union ID).
If you need one or more additional permissions, use the scope parameter, call TTMinis login, and set the scope parameter with a comma-separated list of permissions.
- For account binding, please apply for this scope on the Developer Portal: user.info.basic - Login Kit.
Parameters
Field | Type | Description | Required |
|
| The authorization scope. Default: | No |
|
| Whether to include granted scopes in the response. | No |
Callback parameters
Field | Type | Description |
|
| The authorization code. |
|
| The actual granted scopes. Available when |
|
| Returned on failure. |
Example
TTMinis.authorize(
function (res) {
if (res.error) {
console.error('authorize failed', res.error);
return;
}
console.log('auth code:', res.authResponse.code);
console.log('granted scopes:', res.authResponse.grantedScopes);
},
{
scope: 'user.info.basic',
returnScopes: true,
},
);