Skip to content

Commit 08e2f3c

Browse files
authored
fix: fix getUserInfo not_authenticated bug (#58)
1 parent a455d42 commit 08e2f3c

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,11 @@ Upgrade to dart 3.0.0
5858
- Fix the `UserInfo` abstract class used as mixin incompatibility issue
5959
- SDK now supports Dart ^3.0.0
6060
- < 3.0.0 users please use the previous version of the SDK
61+
62+
## 2.0.1
63+
64+
Bug fix
65+
66+
Issue: `LogtoClient.getUserInfo` method throws an `not authenticated` error when the initial access token is expired.
67+
Expected behavior: The method should refresh the access token and return the user info properly.
68+
Fix: Always get the access token by calling `LogtoClient.getAccessToken`, which will refresh the token automatically if it's expired.

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ packages:
310310
path: ".."
311311
relative: true
312312
source: path
313-
version: "1.2.0"
313+
version: "2.0.1"
314314
matcher:
315315
dependency: transitive
316316
description:

lib/logto_client.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import '/src/modules/token_storage.dart';
1111
import '/src/utilities/utils.dart' as utils;
1212
import 'logto_core.dart' as logto_core;
1313

14+
export '/src/exceptions/logto_auth_exceptions.dart';
1415
export '/src/interfaces/logto_interfaces.dart';
1516
export '/src/utilities/constants.dart';
16-
export '/src/exceptions/logto_auth_exceptions.dart';
1717

1818
/**
1919
* LogtoClient
@@ -306,7 +306,7 @@ class LogtoClient {
306306
try {
307307
final oidcConfig = await _getOidcConfig(httpClient);
308308

309-
final accessToken = await _tokenStorage.getAccessToken();
309+
final accessToken = await getAccessToken();
310310

311311
if (accessToken == null) {
312312
throw LogtoAuthException(

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.0
3+
version: 2.0.1
44
homepage: https://github.com/logto-io/dart
55
documentation: https://docs.logto.io/sdk/flutter/
66

0 commit comments

Comments
 (0)