getOAuthAuthorization method
Future<Map>
getOAuthAuthorization(
- String token,
- String clientId,
- String redirectUri,
- String responseType,
- String scope,
- String? codeChallenge,
- String? codeChallengeMethod,
- String? state,
override
Implementation
@override
Future<Map> getOAuthAuthorization(
String token,
String clientId,
String redirectUri,
String responseType,
String scope,
String? codeChallenge,
String? codeChallengeMethod,
String? state) async {
final String baseUrl = await getBaseUrl;
var filters = [];
var prefixes = [];
filters.add(clientId);
prefixes.add("client_id=");
filters.add(redirectUri);
prefixes.add("redirect_uri=");
filters.add(responseType);
prefixes.add("response_type=");
filters.add(scope);
prefixes.add("scope=");
if (codeChallenge != null) {
filters.add(codeChallenge);
prefixes.add("code_challenge=");
}
if (codeChallengeMethod != null) {
filters.add(codeChallengeMethod);
prefixes.add("code_challenge_method=");
}
if (state != null) {
filters.add(state);
prefixes.add("state=");
}
String params = addFilter(filters, prefixes);
var url = Uri.parse("$baseUrl/oauth/authorize$params");
var response = await http.get(
url,
headers: {"Authorization": "Bearer $token", "x-jwt-account-id": "string"},
);
var data = jsonDecode(response.body);
//print(data);
return data;
}