getAccessToken method
Implementation
Future<String> getAccessToken(String userId) async {
final url = Uri.parse('${_wepinBaseUrl}user/access-token?userId=$userId&refresh_token=$_refreshToken');
final response = await http.get(
url,
headers: headers,
);
if (response.statusCode >= 200 && response.statusCode < 300) {
final responseBody = jsonDecode(response.body);
final token = responseBody['token'];
setAuthToken(token, _refreshToken!);
return token;
} else {
throw WepinError(WepinErrorCode.apiRequestError, 'code: ${response.statusCode} , body: ${response.body}');
}
}