saveTokenCookie function
Implementation
Future<void> saveTokenCookie(String token, String url) async {
try {
final cookie = WebViewCookie(
name: 'personal_access_token',
value: token,
domain: Uri.parse(url).host,
path: '/',
);
await WebViewCookieManager().setCookie(cookie);
final prefs = await SharedPreferences.getInstance();
await prefs.setString('saved_token', token);
debugPrint('[BeMall SDK] Token salvo com sucesso!');
} catch (e) {
captureSdkException(
Exception('Erro ao salvar token: $e'),
stackTrace: StackTrace.current,
);
}
}