Skip to content
Google Spreadsheet실무 경험

How I fixed the Google Spreadsheet JWT 403 PERMISSION_DENIED error

1 min readWorkMoved from my Tistory blogRead the Korean original

On an Autowini project, I got a PERMISSION_DENIED error while fetching multilingual data from a Google spreadsheet with Node.js.

json
{
  "code": 403,
  "message": "Method doesn't allow unregistered callers (callers without established identity). Please use API Key or other form of API consumer identity to call this API.",
  "status": "PERMISSION_DENIED"
}

🔍 Tracking down the cause

At first, I tried to fix it through the spreadsheet's sharing settings and by reissuing the IAM service account key.

  • Gave the service account email editor access in the Google spreadsheet
  • Reissued the service account key in Google Cloud Console IAM

But with only these steps, the error kept happening.

❗️ The cause

In version ^4.1.4 of the google-spreadsheet package, some calls with JWT auth were treated as an unauthorized caller (403 Error).
In other words, no matter how much I changed the IAM or spreadsheet permission settings, the error came from the package version itself not fully supporting that way of handling auth.

✅ The fix

I fixed the problem by upgrading the google-spreadsheet package to ^5.0.2.

bash
# pnpm
pnpm add google-spreadsheet@^5.0.2

After the upgrade, accessing the spreadsheet with JWT auth loaded the data correctly.

js
import { GoogleSpreadsheet } from 'google-spreadsheet';
import { JWT } from 'google-auth-library';
import { credentials } from './credentials.js';

const doc = new GoogleSpreadsheet(SPREADSHEET_DOC_ID);
await doc.useServiceAccountAuth(new JWT({
  email: credentials.client_email,
  key: credentials.private_key,
  scopes: ['https://www.googleapis.com/auth/spreadsheets'],
}));
await doc.loadInfo();

💡 What I took away

  • I felt that when you hit the same error, checking for a package version problem first can be a quick way to fix it.
  • Someone on GitHub had actually run into the same problem (issue #723), and I left a comment on that issue too.
  • #403
  • #Google Spreadsheet JWT
  • #PERMISSION_DENIED

More in Work