Refresh tokens in flutter web SPA

I’ve followed every guide and forum I could find related to getting an Auth0 refresh token in a flutter web SPA. But it’s still returning null.

I can see in the network inspector that there is a refresh token along with the access token (Which I can successfully access) but my SPA can’t seem to return the refresh token and just returns null.

I’m using the CanvasKit renderer if that’s relevant but here’s a checklist of this I’ve done already as I can’t share my source code:
:white_check_mark: Enabled “refresh token” in the auth0 SPA advanced settings
:white_check_mark: Have the “offline_access” scope in flutter code
:white_check_mark: Set useRefreshTokens: true in the onLoad function aswell as the cacheLocation

I’m trying to return the refresh token the same way Im successfully returning the access token on the Credentials instance e.g. “credentials.refreshToken”

I should also note my native iOS app is successfully receiving the refresh tokens. It’s just the flutter web SPA I’m unable to figure out why it’s not working and since I cant find any documentation on specifically getting refresh tokens on flutter web I’m unsure if it’s even supported.

I understand that the refreshing of tokens happens silently in the auth0 api. But I do need to access the refresh token for particular project needs (Which I understand from the documentation is discouraged, but havn’t seen any mention that it’s unsupported)

Hi @amirali,

Welcome to the Auth0 Community!

Do you see any logs related to this refresh token issue? If so, could you provide the log type and description?

Have you seen this article discussing refresh tokens in SPAs? There is a section on Flutter.

Thanks,

Mary Beth

UNRESOLVED
Hi @marybeth.hunter yes I’ve seen that article and I’m doing everything suggested there. The reason I asked if refresh tokens arn’t supported in Flutter or if there are any known limitations is the flutter example in that link is the only example that doesn’t include any kind of useRefreshTokens: true property.

There’s no mention on to how to actually grab the refresh token from the credentials (The credentials in that example are using the non-web instance auth0 not the auth0Web so not helpful)

Hi @amirali,

Flutter does support refresh token rotation: Refresh Token Rotation

How to retrieve stored credentials: auth0-flutter/auth0_flutter/EXAMPLES.md at main · auth0/auth0-flutter · GitHub

Thanks,

Mary Beth