mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
19 lines
543 B
TypeScript
19 lines
543 B
TypeScript
import {
|
|
type AuthorizationServer,
|
|
discoveryRequest,
|
|
processDiscoveryResponse,
|
|
} from "oauth4webapi";
|
|
|
|
export const oauthDiscoveryRequest = (
|
|
issuerUrl: string | URL,
|
|
): Promise<AuthorizationServer> => {
|
|
const issuerUrlurl = new URL(issuerUrl);
|
|
|
|
return discoveryRequest(issuerUrlurl, {
|
|
algorithm: "oidc",
|
|
}).then((res) => processDiscoveryResponse(issuerUrlurl, res));
|
|
};
|
|
|
|
export const oauthRedirectUri = (baseUrl: string, issuer: string) =>
|
|
new URL(`/oauth/sso/${issuer}/callback`, baseUrl).toString();
|