Update LogtoClient.php#30
Conversation
修复用户资料中姓名为中文名时,响应的base64文本格式标准不一的问题
darcyYe
left a comment
There was a problem hiding this comment.
Thanks for the fix. The base64url handling change makes sense, but two issues still need to be addressed before this is ready:
-
The fix only applies to
getIdTokenClaims().getAccessTokenClaims()still decodes the JWT payload with rawbase64_decode(), so valid access tokens that require base64url normalization or padding will still fail.getOrganizationTokenClaims()inherits the same path. -
The test suite still only covers ASCII-only payloads that already worked before this patch. Please add a regression test whose payload actually requires base64url normalization or padding, and cover both the ID-token and access-token claim helpers so this bug class cannot regress silently.
|
|
||
| $playloadDecode = base64_decode($data, true); | ||
|
|
||
| return new IdTokenClaims(...json_decode($playloadDecode, true)); |
There was a problem hiding this comment.
This only fixes base64url decoding for ID tokens. getAccessTokenClaims() still uses raw base64_decode() on the JWT payload, so valid access tokens that need URL-safe normalization or padding will still fail. Please extract this decode logic into a shared helper and reuse it for both token-claim paths.
修复用户资料中姓名为中文名(例如“测试”两个字)时,响应的base64文本格式标准不一的问题
Fix the problem where the response base64 text format is inconsistent when the user's name in the profile is in Chinese.