@@ -109,12 +109,6 @@ class _FpnvService:
109109
110110 def __init__ (self , app ):
111111 self ._project_id = app .project_id
112-
113- if not self ._project_id :
114- cred = app .credential .get_credential ()
115- if hasattr (cred , 'project_id' ):
116- self ._project_id = cred .project_id
117-
118112 if not self ._project_id :
119113 raise ValueError (
120114 'Project ID is required for FPNV. Please ensure the app is '
@@ -171,7 +165,10 @@ def _validate_headers(self, headers: Any) -> None:
171165 raise InvalidFpnvTokenError ("FPNV has no 'kid' claim." )
172166
173167 if headers .get ('typ' ) != 'JWT' :
174- raise InvalidFpnvTokenError ("The provided FPNV token has an incorrect type header" )
168+ raise InvalidFpnvTokenError (
169+ 'The provided FPNV token has an incorrect type header. ' \
170+ f"Expected 'JWT' but got { headers .get ('typ' )!r} ."
171+ )
175172
176173 algorithm = headers .get ('alg' )
177174 if algorithm != _ALGORITHM_ES256 :
@@ -198,12 +195,12 @@ def _decode_and_verify(self, token, signing_key) -> Dict[str, Any]:
198195 except InvalidAudienceError as exception :
199196 raise InvalidFpnvTokenError (
200197 'The provided FPNV token has an incorrect "aud" (audience) claim. '
201- f'Expected payload to include { expected_issuer } .'
198+ f'Expected { expected_issuer } .'
202199 ) from exception
203200 except InvalidIssuerError as exception :
204201 raise InvalidFpnvTokenError (
205202 'The provided FPNV token has an incorrect "iss" (issuer) claim. '
206- f'Expected claim to include { expected_issuer } '
203+ f'Expected { expected_issuer } . '
207204 ) from exception
208205 except ExpiredSignatureError as exception :
209206 raise ExpiredFpnvTokenError (
0 commit comments