requestTokenCredentials method
Future<AuthorizationResponse>
requestTokenCredentials(
- Credentials tokenCredentials,
- String verifier
Obtain a set of token credentials from the server. http://tools.ietf.org/html/rfc5849#section-2.3
Implementation
Future<AuthorizationResponse> requestTokenCredentials(
Credentials tokenCredentials, String verifier) async {
final Map<String, String> additionalParams = <String, String>{
'oauth_verifier': verifier
};
final AuthorizationHeaderBuilder ahb = AuthorizationHeaderBuilder();
ahb.signatureMethod = _platform.signatureMethod;
ahb.clientCredentials = _clientCredentials;
ahb.credentials = tokenCredentials;
ahb.method = 'POST';
ahb.url = _platform.tokenCredentialsRequestURI;
ahb.additionalParameters = additionalParams;
final http.Response res = await _httpClient.post(
Uri.parse(_platform.tokenCredentialsRequestURI),
headers: <String, String>{'Authorization': ahb.build().toString()});
if (res.statusCode != 200) {
throw StateError(res.body);
}
final Map<String, String> params = Uri.splitQueryString(res.body);
return AuthorizationResponse.fromMap(params);
}