Perform OpenID authentication

This commit is contained in:
2024-05-02 22:14:20 +02:00
parent 46648db093
commit b6e15d2cbb
3 changed files with 82 additions and 1 deletions

View File

@ -0,0 +1,28 @@
import { APIClient } from "./ApiClient";
export class AuthApi {
/**
* Start OpenID login
*/
static async StartOpenIDLogin(): Promise<{ url: string }> {
return (
await APIClient.exec({
uri: "/auth/start_oidc",
method: "GET",
})
).data;
}
/**
* Finish OpenID login
*/
static async FinishOpenIDLogin(code: string, state: string): Promise<void> {
await APIClient.exec({
uri: "/auth/finish_oidc",
method: "POST",
jsonData: { code: code, state: state },
});
window.location.href = "/";
}
}