inrupt / inrupt/solid-client-authn-js

Browser/App: Restore session without silent login and redirect

Open
#3,443 4 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

Hey,

In NodeJS there is the possibility for an application to request a refresh token that can be stored on the server. I am developing a hybrid mobile application that will run in a secure context and I use the browser authentication to do so.

Everything works fine, I have a clientId: https://sembeacon.org/id.jsonld that could request a refresh_token, etc...
However, I want to disable the silent login that redirects the user away to the Authorization server whenever they reopen the app,
since other than a browser - this is a much more visible process in a mobile application. I already have my insecure and secure storage configured for localStorage - but this does not seem to work.

From what I see, the client authentication uses the following authentication flow: https://openid.net/specs/openid-connect-core-1_0.html#CodeFlowAuth while the node implementation has a refresh token flow. There does not seem to be a possibility to change this flow since the login flow is defined in:
https://github.com/inrupt/solid-client-authn-js/blob/4902d206dcd6dea3d0fcf9393f9363d644c5709d/packages/browser/src/dependencies.ts#L81-L86
which can not be changed or configured before it is loaded by a session.

Is it possible to somehow to either:

  1. Request a refresh token in the browser
  2. Retrieve and reuse the id_token and access_token to restore the session when the access token has not expired yet?
  3. My next attempt will be to override the clientAuthentication object in each session, to replace the login flow with something that has the RefreshTokenOidcHandler in an AggregateOidcHandler. However, I do not know if this will work and it also feels like a solution for an issue that should not be there. A configuration to use refresh tokens would be useful or at least a solution to persist the access token and id_token for page refresh.

Best,
Maxim

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 with packages/browser/src/dependencies.ts around lines 81-86 and trace how the browser authentication flow is selected for a session. Compare the browser flow with the referenced RefreshTokenOidcHandler and AggregateOidcHandler, then determine which requested behavior—refresh-token use or persisted token restoration—can be supported. Done means the chosen flow is configurable and its behavior is covered by the relevant tests, though no test files are named in the issue.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.