Skip to content

PostgrestException(message: JWT expired, code: PGRST301, details: Unauthorized, hint: null) #788

Open
@EddyHezarian

Description

@EddyHezarian

I have a Flutter app with Supabase backend. when I want to read data from tables for the first 3 times calling the database it's all good working but after 3 times I am facing this error :

PostgrestException(message: JWT expired, code: PGRST301, details: Unauthorized, hint: null)
the way I implement reading data is

 Future<List<BrandModel>> getBrands() async {
  List<BrandModel> data = [];
  try {
    var response = await supabase.from('brand').select();
    data = (response as List).map((e) => BrandModel.fromJson(e)).toList();
  } catch (e) {
    print(e);
  }
  return data;
}

the main function is :

Future<void> main() async {
  //? widget bindings
  WidgetsFlutterBinding.ensureInitialized();
  //? initializing supa
  await Supabase.initialize(
      url: AppConsts.supaBaseURL, anonKey: AppConsts.anonKey);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpostgrestThis issue or pull request is related to postgrest

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions