Skip to content

Commit de35beb

Browse files
authored
fix(dart): idToken claims key fix (#64)
1 parent 08e2f3c commit de35beb

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,16 @@ Bug fix
6666
Issue: `LogtoClient.getUserInfo` method throws an `not authenticated` error when the initial access token is expired.
6767
Expected behavior: The method should refresh the access token and return the user info properly.
6868
Fix: Always get the access token by calling `LogtoClient.getAccessToken`, which will refresh the token automatically if it's expired.
69+
70+
## 2.0.2
71+
72+
Bug fix
73+
74+
Fix the `OpenIdClaims` class key parsing issue:
75+
76+
- `avatar` key is now `picture` mapped from the `picture` key in the token claims
77+
- `phone` key is now `phoneNumber` mapped from the `phone_number` key in the token claims
78+
- `phoneVerified` key is now `phoneNumberVerified` mapped from the `phone_number_verified` key in the token claims
79+
80+
Previous key mapping values are always empty as they are not available in the IdToken claims.
81+
This fix update the key mapping to the correct values.

lib/src/modules/id_token.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@ abstract mixin class UserInfo implements JsonObject {
1313
String? get username => this['username'];
1414

1515
/// URL of the user's profile picture.
16-
String? get avatar => this['avatar'];
16+
String? get picture => this['picture'];
1717

1818
/// Email address of the user.
1919
String? get email => this['email'];
2020

2121
/// Phone number of the user.
22-
String? get phone => this['phone'];
22+
String? get phoneNumber => this['phone_number'];
2323

2424
/// Whether the user's email address has been verified.
2525
String? get emailVerified => this['email_verified'];
2626

2727
/// Whether the user's phone number has been verified.
28-
String? get phoneVerified => this['phone_verified'];
28+
String? get phoneNumberVerified => this['phone_number_verified'];
2929

3030
/// Roles that the user has for API resources.
3131
List<String>? get roles => this['roles'];

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: logto_dart_sdk
22
description: Logto's Flutter SDK packages.
3-
version: 2.0.1
3+
version: 2.0.2
44
homepage: https://github.com/logto-io/dart
55
documentation: https://docs.logto.io/sdk/flutter/
66

0 commit comments

Comments
 (0)