Skip to content

Conversation

@arnaud-robin
Copy link
Member

@arnaud-robin arnaud-robin commented Dec 4, 2025

Problem

Right now users already logged in to the SSO have to click on the login button again to be connected. This extra step should not be necessary and some partners have complained

Proposed solution

This PR uses the "silent=true" parameter in the lasuite login endpoint to avoid showing the IdP login screen if user already have an active session.

Demo

Enregistrement.2026-01-22.171342.mp4

⚠️ Limitation

This feature does not work in development mode (localhost:3000 / localhost:8071).
When frontend and backend are on different origins (and/or IdP is another origin), silent auth is much more likely to fail due to browser privacy rules and cookie context.
Same-domain setups tend to “just work” because everything is first-party and the IdP session is more reliably available.

⚠️ New env

To activate this feature:

FRONTEND_SILENT_LOGIN_ENABLED=true

@arnaud-robin arnaud-robin force-pushed the silent-login branch 2 times, most recently from 2d5d759 to 9b6703f Compare December 4, 2025 09:30
@arnaud-robin
Copy link
Member Author

This implementation is heavily copied from @lebaudantoine work.

@github-actions
Copy link

github-actions bot commented Dec 4, 2025

Size Change: +132 B (0%)

Total Size: 4.19 MB

Filename Size Change
apps/impress/out/_next/static/039b7166/_buildManifest.js 851 B +851 B (new file) 🆕
apps/impress/out/_next/static/3970de76/_buildManifest.js 0 B -850 B (removed) 🏆

compressed-size-action

@arnaud-robin arnaud-robin added the FAST Issues that will improve the AARR (acquisition, activation, retention and recommendation) label Dec 4, 2025
@virgile-dev
Copy link
Collaborator

@AntoLC fyi

Copy link
Collaborator

@AntoLC AntoLC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a test to assert that it is working, the tests don't seem happy btw.

If I understand correctly, even if our cookies is dead (frontend side), if the SSO recognize the user it will not prompt the user again, isn't it ?

@arnaud-robin
Copy link
Member Author

arnaud-robin commented Dec 8, 2025

Yes, I’ll update the tests accordingly. I also plan to make this option configurable so that self-hosted instances using identity providers that don’t support this parameter don’t end up with a broken login flow.

But you're right, the goal is that even if the user has never logged into Docs before, or if the Docs session has expired, we still try to reuse an existing IdP session so the user doesn’t have to click the login button.

@AntoLC AntoLC force-pushed the silent-login branch 2 times, most recently from 5f85107 to 29c29bc Compare January 19, 2026 16:31
@AntoLC AntoLC self-assigned this Jan 20, 2026
@AntoLC AntoLC added the preview label Jan 21, 2026
@AntoLC AntoLC force-pushed the silent-login branch 2 times, most recently from 9793d16 to b66f40b Compare January 22, 2026 13:58
@github-actions
Copy link

github-actions bot commented Jan 22, 2026

Size Change: +239 B (+0.01%)

Total Size: 4.19 MB

Filename Size Change
apps/impress/out/_next/static/3c88bafb/_buildManifest.js 851 B +851 B (new file) 🆕
apps/impress/out/_next/static/168232f9/_buildManifest.js 0 B -852 B (removed) 🏆

compressed-size-action

@AntoLC AntoLC force-pushed the silent-login branch 2 times, most recently from 3cbd12f to 102dc2c Compare January 22, 2026 16:01
@AntoLC AntoLC removed the experiment label Jan 22, 2026
@AntoLC
Copy link
Collaborator

AntoLC commented Jan 22, 2026

🚀 Preview will be available at https://1609-docs.ppr-docs.beta.numerique.gouv.fr/

You can use the existing account with these credentials:

  • username: docs
  • password: docs

You can also create a new account if you want to.

Once this Pull Request is merged, the preview will be destroyed.

@AntoLC AntoLC requested review from Ovgodd and lunika and removed request for Ovgodd and lunika January 22, 2026 16:22
@AntoLC AntoLC force-pushed the silent-login branch 2 times, most recently from 89b3c90 to f1efc67 Compare January 23, 2026 09:47
@AntoLC AntoLC requested review from Ovgodd and lunika January 23, 2026 10:12
Copy link
Collaborator

@Ovgodd Ovgodd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a proposal in the useEffect on index.tsx

Currently users already logged in to the SSO have to click on
the login button again to be connected.
This extra step should not be necessary.

This commit uses the "silent=true" parameter to the login
endpoint to avoid the extra step.
Not every project requires silent login.
This commit adds a new feature flag
FRONTEND_SILENT_LOGIN_ENABLED to enable or
disable silent login functionality.
@AntoLC AntoLC merged commit 989c70e into main Jan 28, 2026
27 of 29 checks passed
@AntoLC AntoLC deleted the silent-login branch January 28, 2026 10:12
@AntoLC AntoLC changed the title ✨(auth) Add slient login ✨(auth) Add silent login Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FAST Issues that will improve the AARR (acquisition, activation, retention and recommendation) frontend preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants