refreshToken static method
Future<BungieNetToken>
refreshToken(
- HttpClient client,
- String clientId,
- String clientSecret,
- String refreshToken,
Implementation
static Future<BungieNetToken> refreshToken(HttpClient client, String clientId,
String clientSecret, String refreshToken) {
final HttpClientConfig config =
HttpClientConfig('POST', '/App/OAuth/token/', null);
config.bodyContentType = 'application/x-www-form-urlencoded';
config.body =
'client_id=$clientId&client_secret=$clientSecret&refresh_token=$refreshToken&grant_type=refresh_token';
return client.request(config).then((HttpResponse response) {
if (response.statusCode == 200) {
return BungieNetToken.fromJson(response.mappedBody);
}
throw OAuthException(response.mappedBody['error'],
response.mappedBody['error_description']);
});
}