a-marenkov / gsheets

A Dart library for working with Google Sheets API.
Other
78 stars 31 forks source link

invalid_grant Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values in the JWT claim. Status code: 400 #96

Open LaTrita97 opened 9 months ago

LaTrita97 commented 9 months ago

I've switched to the version 0.5.0 and when I call the spreadsheet method I receive this error: invalid_grant Invalid JWT: Token must be a short-lived token (60 minutes) and in a reasonable timeframe. Check your iat and exp values in the JWT claim. Status code: 400;

This is my code:

Future<Worksheet?> getWorksheet() async {
    final googleSheets = GSheets(Env.googleSheetReportsCredentials);
    final spreadSheet =
        await googleSheets.spreadsheet(Env.googleSpreadSheetIdReports);
    final worksheet = spreadSheet.sheets.firstWhere(
      (_) => _.spreadsheetId == Env.googleSpreadSheetIdReports,
    );
    return worksheet;
  }

PS. With the same logic and the version 0.4.2 I was able to save and fetch the Spreadsheet data.