Token expiration problem
I created authentication like this
DirectusApiManager directusApiManager = DirectusApiManager(
baseURL: "https://control.seedkurdistan.org",
saveRefreshTokenCallback: (refreshToken) async {
// Create storage
var storage = ref.read(flutterSecureStorageProvider);
await storage.write(key: refreshStorage, value: refreshToken);
},
loadRefreshTokenCallback: () async {
var storage = ref.read(flutterSecureStorageProvider);
var token = await storage.read(key: refreshStorage);
// now if token is expired, we can load it from storage
return token;
});
but still when the token expire it will not automatically use the new one the app crash but if i close and open the app work again
Hello @armanhadifatah ! Could you provide more information about the crash your are mentioning ?
Hello @armanhadifatah ! Could you provide more information about the crash your are mentioning ?
After a while I get error that token expired , but with a refresh its again ok and no error
My guess is that you might have an issue with your saving/loading of the token.
Maybe this doesn't work as expected since I do not know this dependency : ref.read(flutterSecureStorageProvider);
I would love to help more but you need to provide more details : the exact error displayed with stack trace would be a good start :)
My guess is that you might have an issue with your saving/loading of the token. Maybe this doesn't work as expected since I do not know this dependency :
ref.read(flutterSecureStorageProvider);I would love to help more but you need to provide more details : the exact error displayed with stack trace would be a good start :)
Thanks for your reply could you please give me the best way how to do it ?