User Authorization via JSAPI
Call the API to obtain the authorization code via JSAPI. The authorization code can be used to obtain the access token, so as to obtain the app user's information, such as user name and id card number.
Request Sample
<script>
my.getAuthCode({
authClientId: '2160010200871872',
scopes: ['USER_NAME','USER_ID_CARD_NO'],
}, function (res) {
ap.alert(JSON.stringify(res));
});
</script>
Parameters
Property | Type | Required | Description |
scopes | Array | Yes | The scope of authorization. For more information about its valid values, refer to Scope description. |
authClientId | String | Yes | The authClientId about the HK merchant Id. |
success | Function | No | Callback function upon call success. |
fail | Function | No | Callback function upon call failure. |
complete | Function | No | Callback function upon call completion (to be executed upon either call |
Scopes description
Valid value | Description |
USER_NAME | Authorized to obtain user name. |
USER_ID_CARD_NO | Authorized to obtain user ID card number. |
Error Code
Valid value | Description |
3 | No Authorization Result |
11 | Cancel Authorization by User |
12 | Network Error |
13 | Authorization Timeout |
14 | User Authorization Timeout |
15 | System Error |
101 | No eKYC |