flutter_appauth icon indicating copy to clipboard operation
flutter_appauth copied to clipboard

token_failed, Failed to get token

Open itskgore opened this issue 4 months ago • 4 comments

I'm getting the following error after 3 attempts of a successful token refresh method calls in the 4th attempt I'm getting the following error:

PlatformException(token_failed, Failed to get token: invalid_grant: The refresh token is invalid or expired., null, null)

I'm using OKTA for OAuth.

This is my method:

final oktaRefresh = await appAuth.token(TokenRequest(
            '${Repository.env!['OKTACLIENTID']}',
            '${Repository.env!['OKTAREDIRECTURL']}',
            discoveryUrl:
                'https://${Repository.env!['OKTADOMAIN']}/oauth2/${Repository.env!['OKTAUTHORIZER']}/.well-known/openid-configuration',
            refreshToken: refreshToken,
            grantType: "refresh_token",
            scopes: ["openid", "profile", "offline_access"]));

itskgore avatar Feb 20 '24 15:02 itskgore