Support oidc action param for login and register page (#2389)
authorAjay Bura <32841439+ajbura@users.noreply.github.com>
Wed, 16 Jul 2025 10:49:13 +0000 (16:19 +0530)
committerGitHub <noreply@github.com>
Wed, 16 Jul 2025 10:49:13 +0000 (20:49 +1000)
src/app/pages/auth/SSOLogin.tsx
src/app/pages/auth/login/Login.tsx
src/app/pages/auth/register/Register.tsx

index d0cdaeb68ac98c43fd439c04e8a27331d539f2bb..3ff1a22950ad66cf303432db34a0dc136701d3cb 100644 (file)
@@ -1,19 +1,21 @@
 import { Avatar, AvatarImage, Box, Button, Text } from 'folds';
-import { IIdentityProvider, createClient } from 'matrix-js-sdk';
+import { IIdentityProvider, SSOAction, createClient } from 'matrix-js-sdk';
 import React, { useMemo } from 'react';
 import { useAutoDiscoveryInfo } from '../../hooks/useAutoDiscoveryInfo';
 
 type SSOLoginProps = {
   providers?: IIdentityProvider[];
   redirectUrl: string;
+  action?: SSOAction;
   saveScreenSpace?: boolean;
 };
-export function SSOLogin({ providers, redirectUrl, saveScreenSpace }: SSOLoginProps) {
+export function SSOLogin({ providers, redirectUrl, action, saveScreenSpace }: SSOLoginProps) {
   const discovery = useAutoDiscoveryInfo();
   const baseUrl = discovery['m.homeserver'].base_url;
   const mx = useMemo(() => createClient({ baseUrl }), [baseUrl]);
 
-  const getSSOIdUrl = (ssoId?: string): string => mx.getSsoLoginUrl(redirectUrl, 'sso', ssoId);
+  const getSSOIdUrl = (ssoId?: string): string =>
+    mx.getSsoLoginUrl(redirectUrl, 'sso', ssoId, action);
 
   const withoutIcon = providers
     ? providers.find(
index 6b9f1223c62f44f11ca3e109cd45de7bf8a9ed9b..2f04a73372fa4b0c31a14395bb136d4920beedfc 100644 (file)
@@ -1,6 +1,7 @@
 import React, { useMemo } from 'react';
 import { Box, Text, color } from 'folds';
 import { Link, useSearchParams } from 'react-router-dom';
+import { SSOAction } from 'matrix-js-sdk';
 import { useAuthFlows } from '../../../hooks/useAuthFlows';
 import { useAuthServer } from '../../../hooks/useAuthServer';
 import { useParsedLoginFlows } from '../../../hooks/useParsedLoginFlows';
@@ -76,6 +77,7 @@ export function Login() {
           <SSOLogin
             providers={parsedFlows.sso.identity_providers}
             redirectUrl={ssoRedirectUrl}
+            action={SSOAction.LOGIN}
             saveScreenSpace={parsedFlows.password !== undefined}
           />
           <span data-spacing-node />
index d2986d701d82f989f4ddf479565c19ba1aaf9b00..7176489ba35410b5bca501bf19f62fe5ef9402a5 100644 (file)
@@ -1,6 +1,7 @@
 import React, { useMemo } from 'react';
 import { Box, Text, color } from 'folds';
 import { Link, useSearchParams } from 'react-router-dom';
+import { SSOAction } from 'matrix-js-sdk';
 import { useAuthServer } from '../../../hooks/useAuthServer';
 import { RegisterFlowStatus, useAuthFlows } from '../../../hooks/useAuthFlows';
 import { useParsedLoginFlows } from '../../../hooks/useParsedLoginFlows';
@@ -83,6 +84,7 @@ export function Register() {
           <SSOLogin
             providers={sso.identity_providers}
             redirectUrl={ssoRedirectUrl}
+            action={SSOAction.REGISTER}
             saveScreenSpace={registerFlows.status === RegisterFlowStatus.FlowRequired}
           />
           <span data-spacing-node />