exchangeCodeForToken method
Implementation
Future<Map<String, dynamic>> exchangeCodeForToken({
required String code,
required String flowName
}) async {
final String tokenUrl =
"https://astroconnect.b2clogin.com/astroconnect.onmicrosoft.com/$flowName/oauth2/v2.0/token";
final data = {
"grant_type": "authorization_code",
"client_id": clientId,
"code": code,
"redirect_uri": redirectUri,
"scope": scope
};
try {
final response = await _dio.post(
tokenUrl,
data: data,
options: Options(
contentType: Headers.formUrlEncodedContentType,
),
);
return response.data;
} on DioException catch (e) {
return {"error" : e};
}
}