rename frontend directory to frontend
This commit is contained in:
parent
71a9b69e04
commit
c7d996dbeb
30 changed files with 1 additions and 1 deletions
18
crawler/frontend/src/auth/authService.ts
Normal file
18
crawler/frontend/src/auth/authService.ts
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { User, UserManager } from 'oidc-client-ts';
|
||||
import { oidcConfig } from './config';
|
||||
|
||||
const userManager = new UserManager(oidcConfig);
|
||||
|
||||
export const login = () => userManager.signinRedirect();
|
||||
export const logout = () => userManager.signoutRedirect();
|
||||
export const handleCallback = () => userManager.signinRedirectCallback();
|
||||
|
||||
export const getUser = async (): Promise<User | null> => {
|
||||
try {
|
||||
const user = await userManager.getUser();
|
||||
return user;
|
||||
} catch (error) {
|
||||
console.error('Error fetching user:', error);
|
||||
return null;
|
||||
}
|
||||
};
|
||||
13
crawler/frontend/src/auth/config.ts
Normal file
13
crawler/frontend/src/auth/config.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { WebStorageStateStore } from "oidc-client-ts";
|
||||
|
||||
export const oidcConfig = {
|
||||
authority: "https://authentik.viktorbarzin.me/application/o/wrongmove/",
|
||||
client_id: "5AJKRgcdgVm1OyApBzFkadDFfStW9a555zwv2MOe",
|
||||
redirect_uri: "https://devvm.viktorbarzin.lan/callback",
|
||||
userStore: new WebStorageStateStore({ store: window.localStorage }),
|
||||
response_type: 'code', // PKCE flow (recommended for SPAs)
|
||||
scope: 'openid profile email', // Requested scopes
|
||||
automaticSilentRenew: true, // Renew tokens silently
|
||||
filterProtocolClaims: true,
|
||||
loadUserInfo: true,
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue