inrupt / inrupt/solid-client-authn-js

Provide session or sessionInfo to onLogin callback

Open
#1,052 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
77
Forks
49
Avg merge
18h 20m
Merged PRs (30d)
32

Description

Search terms you've used

session, sessionInfo, onLogin

Impacted environment

In which environment would the proposed feature apply ?

  • The browser
  • Node.js (Though mostly the browser)
  • Other (please specify): ...
  • I'm not sure.
Feature suggestion

When using the default session, it would be nice if I could access the sessionInfo, or possibly even the entire session, from the callback handler passed to onLogin.

Expected functionality/enhancement
import { onLogin } from "@inrupt/solid-client-authn-browser";

onLogin((sessionInfo) => {
    console.log("This should be a safe operation:", sessionInfo.webId);
});
Actual functionality/enhancement

Currently you have to add another call to getDefaultSession() in the callback, and a type checker cannot statically verify that its webId property is set and isLoggedIn is true.

Use Cases

I've got a central place in my app that keeps track of the user's session, and I update it whenever a login or logout event is thrown.

Additional information

N/A

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the onLogin callback and getDefaultSession entry points in the TypeScript authentication code, then inspect how sessionInfo and the default session are typed. Define the callback contract so it receives the requested session information, and verify that the webId and logged-in state are represented safely for login handlers.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
authentication
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.