Skip to content

Commit

Permalink
Store session ID in SessionStorage instead of window.name
Browse files Browse the repository at this point in the history
We've been storing sessionID in window.name because of #1629.
However, `window.name` is not preserved in mobile Safari during OAuth session.

It looks like Flutter has fixed that in launchUrl() (https://github.com/flutter/packages/blob/main/packages/url_launcher/url_launcher_web/lib/url_launcher_web.dart#L87)
https://stackoverflow.com/a/73821739/1435891
  • Loading branch information
FeodorFitsner committed Mar 13, 2024
1 parent 7b02df9 commit 14d3f5b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/flet/lib/src/utils/session_store_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ import 'dart:html' as html;

import 'package:flutter/foundation.dart';

const String _sessionIdKey = "_flet_session_id";

class SessionStore {
static String? get sessionId {
return html.window.name;
return get(_sessionIdKey);
}

static set sessionId(String? value) {
html.window.name = value;
set(_sessionIdKey, value ?? "");
}

static String? get(String name) {
debugPrint("Get session storage $name");

return html.window.sessionStorage[name];
}

Expand Down

0 comments on commit 14d3f5b

Please sign in to comment.