Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

failed to parse token

Open
#156 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Active
Tech stack
go

Research direction

Start at s.iasMiddleware.ParseAndValidateJWT and follow the listed validator.go, token.go, and openid/token_gen.go trace; inspect how the email claim is decoded when IAS mappings contain Corporate and Identity values. Clarify the intended supported claim shape and verify the behavior with a regression case for the reported token; done when the failure is handled according to that decision.

Written by the indexing model from the issue text.

Description

We are using IAS JWT validation to verify that our JWTs are valid.

We have seen that many customers receive an error like this:                                                                                                                                                  
                                                                                                                                                                                                                
{"error":"failed to parse token: failed to decode value for key email: error reading next value: json: cannot unmarshal array into Go value of type                                                           
string","file":"server.go:1008","func":"main.(*Server).handleLoginFormAuthentication","level":"warning","msg":"IAS JWT cannot be parsed","time":"2026-08-25T23:44:17.923Z"}                                     
I looked at the IAS attribute mapping, and it seems that the customers added two fields to the mapping: Corporate and Identity values.                                                                          
                                                                                                                                                                                                                
For example:                                                                                                                                                                                                    

This is the trace:

s.iasMiddleware.ParseAndValidateJWT(iasJwtToken)
↓
vendor/cloud-security-client-go/auth/validator.go:22
NewToken(rawToken)
↓
vendor/cloud-security-client-go/auth/token.go:40
jwt.ParseString(encodedToken, jwt.WithToken(openid.New()))
↓
vendor/lestrrat-go/jwx/jwt/jwt.go:463
json.Unmarshal(payload, ctx.token) ← wraps error as "failed to parse token"
↓
vendor/lestrrat-go/jwx/jwt/openid/token_gen.go:970
stdToken.UnmarshalJSON(buf) ← iterates over all claims
↓
vendor/lestrrat-go/jwx/jwt/openid/token_gen.go:1036
json.AssignNextStringToken(&t.email, dec) ← fails: array ≠ string
↓
vendor/lestrrat-go/jwx/internal/json/json.go:45
dec.Decode(&val) ← ROOT CAUSE: strict string decoding

Dominant language
Go
Stars
14
Forks
11
Avg merge
2h 33m
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from SAP/cloud-security-client-go

All issues in SAP/cloud-security-client-go

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.