Skip to content

Commit

Permalink
fix: fix getUserInfo not_authenticated bug (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
simeng-li authored Jun 3, 2024
1 parent a455d42 commit 08e2f3c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,11 @@ Upgrade to dart 3.0.0
- Fix the `UserInfo` abstract class used as mixin incompatibility issue
- SDK now supports Dart ^3.0.0
- < 3.0.0 users please use the previous version of the SDK

## 2.0.1

Bug fix

Issue: `LogtoClient.getUserInfo` method throws an `not authenticated` error when the initial access token is expired.
Expected behavior: The method should refresh the access token and return the user info properly.
Fix: Always get the access token by calling `LogtoClient.getAccessToken`, which will refresh the token automatically if it's expired.
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.2.0"
version: "2.0.1"
matcher:
dependency: transitive
description:
Expand Down
4 changes: 2 additions & 2 deletions lib/logto_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import '/src/modules/token_storage.dart';
import '/src/utilities/utils.dart' as utils;
import 'logto_core.dart' as logto_core;

export '/src/exceptions/logto_auth_exceptions.dart';
export '/src/interfaces/logto_interfaces.dart';
export '/src/utilities/constants.dart';
export '/src/exceptions/logto_auth_exceptions.dart';

/**
* LogtoClient
Expand Down Expand Up @@ -306,7 +306,7 @@ class LogtoClient {
try {
final oidcConfig = await _getOidcConfig(httpClient);

final accessToken = await _tokenStorage.getAccessToken();
final accessToken = await getAccessToken();

if (accessToken == null) {
throw LogtoAuthException(
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: logto_dart_sdk
description: Logto's Flutter SDK packages.
version: 2.0.0
version: 2.0.1
homepage: https://github.com/logto-io/dart
documentation: https://docs.logto.io/sdk/flutter/

Expand Down

0 comments on commit 08e2f3c

Please sign in to comment.