Nhảy tới nội dung

getAccessToken

Yêu cầu

Phải gọi api login trước khi lấy thông tin xác thực user

Lấy thông tin xác thực user.

Parameters

Object object

PropertyTypeDefaultRequiredDescriptionMinimum Version
successfunctionCallback function khi gọi api thành công
failfunctionCallback function khi gọi api thất bại

Return Values

Promise<string accessToken>

Sample Code

import api from 'zmp-sdk';

api.login({
success: () => {
// xử lý khi gọi api thành công
api.getAccessToken({
success: (accessToken) => {
// xử lý khi gọi api thành công
},
fail: (error) => {
// xử lý khi gọi api thất bại
console.log(error);
}
});
},
fail: (error) => {
// xử lý khi gọi api thất bại
console.log(error);
}
});

// hoặc
const test = async () => {
try {
await api.login({});
const accessToken = await api.getAccessToken({});
} catch (error) {
// xử lý khi gọi api thất bại
console.log(error);
}
}