feat: use client-provided SSO redirectUri (#1155)

Co-authored-by: Hampus <[email protected]>
This commit is contained in:
Sven Uhrenholdt FrenzelandHampus authored and GitHub committed 2026-06-24 02:15:51 +02:00
1 parent b80d41a7bf
commit a45693f581
7 files changed
+92 -19

No files matched your search

@@ -16,6 +16,9 @@ import type {ValueOf} from '@fluxer/constants/src/ValueOf';
import type {
AuthRegistrationPendingApprovalResponse,
RegisterRequest,
SsoCompleteResponse,
SsoStartRequest,
SsoStartResponse,
} from '@fluxer/schema/src/domains/auth/AuthSchemas';
import type {UserPartial} from '@fluxer/schema/src/domains/user/UserResponseSchemas';
import type {AuthenticationResponseJSON, PublicKeyCredentialRequestOptionsJSON} from '@simplewebauthn/browser';
@@ -627,20 +630,26 @@ export async function completeLogin(
}
}
export async function startSso(redirectTo?: string): Promise<{
authorization_url: string;
}> {
const response = await http.post<{
authorization_url: string;
}>(Endpoints.AUTH_SSO_START, {
body: {redirect_to: redirectTo},
export async function startSso({
redirectTo,
redirectUri,
}: {
redirectTo?: string;
redirectUri?: string;
} = {}): Promise<SsoStartResponse> {
const body: SsoStartRequest = {
redirect_to: redirectTo,
redirect_uri: redirectUri,
};
const response = await http.post<SsoStartResponse>(Endpoints.AUTH_SSO_START, {
body,
headers: withPlatformHeader(),
});
return response.body;
}
export async function completeSso({code, state}: {code: string; state: string}): Promise<TokenResponse> {
const response = await http.post<TokenResponse>(Endpoints.AUTH_SSO_COMPLETE, {
export async function completeSso({code, state}: {code: string; state: string}): Promise<SsoCompleteResponse> {
const response = await http.post<SsoCompleteResponse>(Endpoints.AUTH_SSO_COMPLETE, {
body: {code, state},
headers: withPlatformHeader(),
});