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