getRequestToken static method
Request user authorization token
Implementation
static Future<RequestToken> getRequestToken(
String apiKey,
String apiSecretKey,
String redirectURI,
bool forceLogin,
) async {
final authParams = requestHeader(
apiKey: apiKey,
redirectURI: redirectURI,
);
final params = await httpPost(
REQUEST_TOKEN_URL,
authParams,
apiKey,
apiSecretKey,
);
var authorizeURI = '$AUTHORIZE_URI?oauth_token=${params!['oauth_token']}';
//
if (forceLogin) {
authorizeURI += '&force_login=true';
}
final requestToken = RequestToken(params, authorizeURI);
if (requestToken.callbackConfirmed.toLowerCase() != 'true') {
throw StateError('oauth_callback_confirmed mast be true');
}
return requestToken;
}