Home > OS >  Googlesheet with Flutter : invalid_grant Invalid JWT
Googlesheet with Flutter : invalid_grant Invalid JWT

Time:12-02

So, I've spent the past 2 hours searching for a solution for this but I cannot get anywhere. I've followed this enter image description here enter image description here

My code: (I'm calling the initSheet() in main)

class SpreadSheet {
  static late final gsheets;
  static late final spreadsheet;

  static Future<bool> initSheet() async {
    // TODO: Handle errors (Wrong time....)
    gsheets = GSheets(_credentials);

    /// link looks like so https://docs.google.com/spreadsheets/d/YOUR_SPREADSHEET_ID/edit#gid=0
    /// [YOUR_SPREADSHEET_ID] in the path is the id your need
    spreadsheet = await gsheets
        .spreadsheet("1t51H_CSHPFoKB7KW_AcGMi3gwyJnecfM_k5wvk4OQ04");
    return (spreadsheet == null ? false : true);
  }
}

CodePudding user response:

Somehow, the code is running perfectly now. I used flutter clean & had to re-download gradle-6.9 zip because it got corrupted somehow. I still don't know if that's exactly what actually fixed it or no but it'll be worth the try if someone faces this problem again.

  • Related