JWT (JSON Web Tokens) Errors | Invalid JWT Signature (2024)

Errors are the best especially when they are written in a way where you become a decipherer. I remember the good old days when all the error codes I got were only numbers and maybe letters mixed in and there wasn’t any online searching to easly get interpretations.

I’ve been working with Google Cloud products and connecting to services from my laptop like Storage and BigQuery. Over the last several months, I’ve hit up against a JWT error, invalid_grant:Invalid JWT Signature, a couple times, and below provides an overview of how I resolved it, which was basically updating the expired service account key.

“The mechanics of server-to-server authentication interactions require applications to create and cryptographically sign JSON Web Tokens (JWTs).” JWTs are signed tokens to authenticate your server to server connections.

This page on Using OAuth 2.0 for Server to Server Applications has a section in the middle called JWT error codes which gives more details about the different errors you may see and how to resolve them. Its a good place to start for more information.

For my error, invalid_grant:Invalid JWT Signature, the way to resolve wasn’t included in the list under JWT error codes. Basically, the Service Account key expired, and I needed to generate a new one.

I did find someone in a StackOverflow thread who helped me hone in on this with this comment: The JWT assertion is signed with a private key not associated with the service account identified by the client email.

I thought for a moment the email under my local gcloud config might be the problem, but it ended up being the expired key. Thus, the key was not associated with the service account anymore.

In order to fix this, go to the APIs & Services on the Google Cloud Console.

JWT (JSON Web Tokens) Errors | Invalid JWT Signature (3)

Look under Service Accounts, for the email account you are using for your project.

JWT (JSON Web Tokens) Errors | Invalid JWT Signature (4)

If you don’t remember what that email address is then you can look it up with the command.

gcloud config list

On Google Cloud Console, choose the edit symbol next to that email account you are using.

JWT (JSON Web Tokens) Errors | Invalid JWT Signature (5)

Choose the Keys section.

JWT (JSON Web Tokens) Errors | Invalid JWT Signature (6)

Check if your service account key is Active or Expired.

If you don’t know what the service account key is that you are using, look at the file you are using on your computer which is probably under ~/.oauth, especially if you are on a Mac. If not then look at the file path associated with GOOGLE_APPLICATION_CREDENTIALS environment variable to find the service account key file.

Part of the key number may be in the file name; otherwise, it will be inside the service account key file.

If a key has Expired then choose Add Key which will add one that is Active and download a json service account key file to your computer.

JWT (JSON Web Tokens) Errors | Invalid JWT Signature (7)

Move that json key file to where you reference your files. Some gcloud server connections automatically look under ~/.oauth, but you can change that location with the GOOGLE_APPLICATION_CREDENTIALS environment variable.

If you have GOOGLE_APPLICATION_CREDENTIALS environment variable defined in your ~/.bashrc or ~/.bash_profile file then make sure to update the location there.

This post reviews JWT errors and specifically how to resolve the invalid_grant:Invalid JWT Signature error. For Invalid JWT Signature, check if your service account key has expired. Go to your APIs & Services to add a new key if it has.

JWT (JSON Web Tokens) Errors | Invalid JWT Signature (2024)
Top Articles
Has The Bitcoin Network Ever Gone Down?
3 Crucial Tips To Help When Changing Financial Advisors — Stash Wealth
Mybranch Becu
Durr Burger Inflatable
Senior Tax Analyst Vs Master Tax Advisor
Jesus Calling December 1 2022
Coffman Memorial Union | U of M Bookstores
Teenbeautyfitness
Holly Ranch Aussie Farm
The Best English Movie Theaters In Germany [Ultimate Guide]
Wfin Local News
270 West Michigan residents receive expert driver’s license restoration advice at last major Road to Restoration Clinic of the year
Imbigswoo
Locate Td Bank Near Me
Hardly Antonyms
Caroline Cps.powerschool.com
Sports Clips Plant City
Zürich Stadion Letzigrund detailed interactive seating plan with seat & row numbers | Sitzplan Saalplan with Sitzplatz & Reihen Nummerierung
Rosemary Beach, Panama City Beach, FL Real Estate & Homes for Sale | realtor.com®
U/Apprenhensive_You8924
Clarksburg Wv Craigslist Personals
Eka Vore Portal
Walmart Double Point Days 2022
Midlife Crisis F95Zone
Roster Resource Orioles
Craigslist Appomattox Va
Lista trofeów | Jedi Upadły Zakon / Fallen Order - Star Wars Jedi Fallen Order - poradnik do gry | GRYOnline.pl
Wkow Weather Radar
Riversweeps Admin Login
Idle Skilling Ascension
Bra Size Calculator & Conversion Chart: Measure Bust & Convert Sizes
Afni Collections
Craigslist Sf Garage Sales
Homewatch Caregivers Salary
Mrstryst
Kokomo Mugshots Busted
Haley Gifts :: Stardew Valley
Admissions - New York Conservatory for Dramatic Arts
Jasgotgass2
Scarlet Maiden F95Zone
Gopher Hockey Forum
Shoecarnival Com Careers
Rocky Bfb Asset
2024-09-13 | Iveda Solutions, Inc. Announces Reverse Stock Split to be Effective September 17, 2024; Publicly Traded Warrant Adjustment | NDAQ:IVDA | Press Release
Candise Yang Acupuncture
Squalicum Family Medicine
Rise Meadville Reviews
Dlnet Deltanet
Missed Connections Dayton Ohio
Mike De Beer Twitter
Thrift Stores In Burlingame Ca
Varsity Competition Results 2022
Latest Posts
Article information

Author: Maia Crooks Jr

Last Updated:

Views: 6080

Rating: 4.2 / 5 (63 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Maia Crooks Jr

Birthday: 1997-09-21

Address: 93119 Joseph Street, Peggyfurt, NC 11582

Phone: +2983088926881

Job: Principal Design Liaison

Hobby: Web surfing, Skiing, role-playing games, Sketching, Polo, Sewing, Genealogy

Introduction: My name is Maia Crooks Jr, I am a homely, joyous, shiny, successful, hilarious, thoughtful, joyous person who loves writing and wants to share my knowledge and understanding with you.