Skip to content

Commit bcf9dd7

Browse files
authored
fix(dart): remove redirect to end session end point on signout (#16)
1 parent 93cda90 commit bcf9dd7

File tree

2 files changed

+3
-29
lines changed

2 files changed

+3
-29
lines changed

example/lib/main.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class _MyHomePageState extends State<MyHomePage> {
9999
textStyle: const TextStyle(fontSize: 20),
100100
),
101101
onPressed: () async {
102-
await logtoClient.signOut(redirectUri: redirectUri);
102+
await logtoClient.signOut();
103103
render();
104104
},
105105
child: const Text('Sign Out'),

lib/logto_client.dart

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'package:flutter/material.dart';
21
import 'package:flutter_web_auth/flutter_web_auth.dart';
32
import 'package:http/http.dart' as http;
43
import 'package:jose/jose.dart';
@@ -70,12 +69,7 @@ class LogtoClient {
7069

7170
bool _loading = false;
7271

73-
Future<void> signIn(
74-
String redirectUri, {
75-
Color? primaryColor,
76-
Color? backgroundColor,
77-
Widget? title,
78-
}) async {
72+
Future<void> signIn(String redirectUri) async {
7973
if (_loading) throw Exception('Already signing in...');
8074
final httpClient = _httpClient ?? http.Client();
8175

@@ -155,9 +149,7 @@ class LogtoClient {
155149
expiresIn: tokenResponse.expiresIn);
156150
}
157151

158-
Future<void> signOut({
159-
String? redirectUri,
160-
}) async {
152+
Future<void> signOut() async {
161153
// Throw error is authentication status not found
162154
final idToken = await _tokenStorage.idToken;
163155

@@ -187,25 +179,7 @@ class LogtoClient {
187179
}
188180
}
189181

190-
final postLogoutRedirectUri =
191-
redirectUri == null ? null : Uri.parse(redirectUri);
192-
193-
final signOutUri = logto_core.generateSignOutUri(
194-
endSessionEndpoint: oidcConfig.endSessionEndpoint,
195-
idToken: idToken.serialization,
196-
postLogoutRedirectUri: postLogoutRedirectUri,
197-
);
198-
199182
await _tokenStorage.clear();
200-
201-
if (postLogoutRedirectUri != null) {
202-
await FlutterWebAuth.authenticate(
203-
url: signOutUri.toString(),
204-
callbackUrlScheme: postLogoutRedirectUri.scheme,
205-
);
206-
} else {
207-
await httpClient.get(signOutUri);
208-
}
209183
} finally {
210184
if (_httpClient == null) {
211185
httpClient.close();

0 commit comments

Comments
 (0)