Skip to content

Conversation

zatteo
Copy link
Member

@zatteo zatteo commented Aug 28, 2025

Login button

Open Twake SSO for Twake SaaS users.

Screenshot 2025-08-28 at 09 35 41

Company login by email

Asks for email and start an autodiscovery mechanism fetching a .well-known file at a known URL to load the SSO of the company.

Screenshot 2025-08-28 at 09 35 44

Company login by url

Good old direct login using instance URL kept for self hosted users and as last resort.

Screenshot 2025-08-28 at 09 35 46

Todo :

  •  improve the login success page
image

zatteo added 6 commits August 27, 2025 11:39
OIDC url is different that base url we use for usual bitwarden
compatible routes so we need to be able to save this OIDC url in
environment service.
This login success page will be used as redirect_uri for SSO login.
It asks to open the extension to finish the login because it cannot
be done automatically.
This home view now display UI for :
- login with Twake SSO (implementation starting in this PR)
- login directly to the stack by asking Cozy URL (already implemented)
- login with external SSO by asking a company email (to be implemented)
Forward instance and OIDC code returned by OIDC login success page
If on login view we have instance and OIDC code :
- Forward code argument from login view to login request method
- If code argument is present, do a different login request method
@zatteo zatteo requested review from Benibur and Ldoppea as code owners August 28, 2025 07:31
const redirectUri = getLoginSuccessPageUri(extensionUri);

BrowserApi.createNewTab(
`https://oauthcallback.cozy.works/oidc/bitwarden/twake?redirect_uri=${redirectUri}`, // TODO: update URL with production environment
Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe I should find a simple way to switch between environment here 🤔 like clicking multiple times on the logo or something like this

Copy link
Member Author

Choose a reason for hiding this comment

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

I propose something here 74683dd

For external SSO, we need to fetch the OIDC login uri at a fixed location that can be infered from the email address of the user. We implement a first way with .well-known. We may implement a DoH way later.
In production, we need oauthcallback.mycozy.cloud. To test, we may
need other stack environment. So here I implement a simple way to
change this environment by clicking on a logo.
Comment on lines +302 to +314
this.logoClickCount++;

if (this.logoClickCount >= 6) {
const rest = this.logoClickCount % 3;

if (rest === 0) {
this.baseUri = DEV_STACK_OAUTHCALLBACK_URI;
} else if (rest === 1) {
this.baseUri = INT_STACK_OAUTHCALLBACK_URI;
} else if (rest === 2) {
this.baseUri = PROD_STACK_OAUTHCALLBACK_URI;
}

Copy link

Choose a reason for hiding this comment

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

i'm not sure about this part, we change the environment based on the number of clicks we do on the application logo?

Copy link
Member Author

Choose a reason for hiding this comment

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

Exactly

@zatteo zatteo merged commit d2a5915 into master Sep 22, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants