fix(auth): removed groups from token

This commit is contained in:
2025-02-17 17:55:25 +01:00
parent 77745a6207
commit 55be075ce5
4 changed files with 3 additions and 5 deletions

View File

@ -91,9 +91,8 @@ def get_current_user_sync(token: str) -> UserInfo:
)
try:
payload = decode_token(token)
groups = payload.get("groups")
email = payload.get("email")
if not groups or not email:
if not email:
raise credentials_exception
except Exception as exc:
raise credentials_exception from exc

View File

@ -60,7 +60,7 @@ class UserRouter(BaseRouter):
user = self._get_user(user_login)
if user is None:
raise HTTPException(status_code=401, detail="User not found or password is incorrect")
token = create_access_token(data={"groups": list(user.groups), "email": user.email})
token = create_access_token(data={"email": user.email})
response.set_cookie(key="access_token", value=token, httponly=True, secure=self.use_ssl)
return token

View File

@ -27,7 +27,7 @@ function handle_request(handler: HttpHandler, req: HttpRequest<any>) {
error: (err: any) => {
if (err instanceof HttpErrorResponse) {
console.log('err.status', err);
if (err.status === 401) {
if (err.status === 401 && !err.url?.includes('login')) {
logout();
}
}

View File

@ -21,7 +21,6 @@ export class AuthService {
}
setSession(authResult: string) {
console.log(authResult);
// it would be good to get an expiration date for the token...
localStorage.setItem('id_session', this.getRandomId());
}