K
Kinde6mo ago
jasdeep

flutter SDK and getToken

hi, I am using Flutter SDK and running into a situation where my accessToken and refreshToken have expired. As per docs I am using
Future<String> getNewToken() async {
String? token = await sdk.getToken();

if (token == null) {
// Redirect user to the login page
return 'Refresh Token Expired';
}

var box = await hiveEncryptedBox();
await box.put('token', token);

return token;
}
Future<String> getNewToken() async {
String? token = await sdk.getToken();

if (token == null) {
// Redirect user to the login page
return 'Refresh Token Expired';
}

var box = await hiveEncryptedBox();
await box.put('token', token);

return token;
}
method to return 'Refresh token Expired' string so that I can initiate a new login process but what I am getting is that
sdk.getToken();
sdk.getToken();
call is throwing 400 Bad Request error. The error response I get back is
{"error":"invalid_grant","error_description":"The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
{"error":"invalid_grant","error_description":"The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
I face no issues in refreshing accessTokens as long as refreshToken is valid. Can someone point out to me what am I missing here?
1 Reply
Daniel_Kinde
Daniel_Kinde6mo ago
Hi, I looks like there could be an issue there, could you capture the error for now? If possible could you also raise an issue on the flutter github? I minimal repo will help us get this resolved. https://github.com/kinde-oss/kinde-flutter-sdk
GitHub
GitHub - kinde-oss/kinde-flutter-sdk: Kinde Flutter SDK
Kinde Flutter SDK. Contribute to kinde-oss/kinde-flutter-sdk development by creating an account on GitHub.
Want results from more Discord servers?
Add your server