Skip to content

Commit b85daf6

Browse files
login: use session.restore(), not init() (sso#1)
Session.init() doesn't exist — that method is on SessionDatabase, which Session uses internally. The correct public API for hydrating a previous session from storage is session.restore(); for finalizing a redirect-back from the IdP it's session.handleRedirectFromLogin(). Matches the pattern in solid-oidc's example.html.
1 parent afb7d1f commit b85daf6

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

login.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ async function init() {
6262
const { idp, next } = readConfig();
6363
const session = new Session();
6464

65-
// Hydrate any prior session OR finalize a redirect-back from the IdP.
65+
// Finalize a redirect-back from the IdP (if we're coming back),
66+
// otherwise try to restore a previous session from storage.
6667
try {
67-
await session.init();
6868
if (location.search.includes('code=')) {
6969
await session.handleRedirectFromLogin();
70+
} else if (!session.isActive) {
71+
await session.restore();
7072
}
7173
} catch (err) {
7274
setStatus(`Sign-in failed: ${err.message}`, true);

0 commit comments

Comments
 (0)