Skip to content

Commit

Permalink
fix: 🐛 fix refresh accesstoken every seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
nutfdt committed Aug 9, 2024
1 parent 0277854 commit e2e7232
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ The variables `X_OVH_TOKEN` and `API_OVH_TOKEN` must en set in your env. See [In
This will create a draft release in github (to validate) and some docker image packages with this tag.
> If you made a tagging error, run `make untag`. This will delete the tag locally and in the remote.
## Testing the expert contact path
1. Set your User Agent with 'SAID'
2. Click on the button 'Contacter un expert' on the result page or go to localhost:3000/expert-contact
This will redirect you to a login page where you have two options :
* If you want to test the police path, use `police` as username and `password` as password.
* For the gendarmerie path, use `gendarmerie` as username and `password` as password.

## Inspirations
- https://testdriven.io/blog/developing-a-single-page-app-with-fastapi-and-vuejs/
- https://medium.com/bb-tutorials-and-thoughts/how-to-serve-vue-js-application-with-nginx-and-docker-d8a872a02ea8
Expand Down
1 change: 0 additions & 1 deletion backend/src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ async def get_current_user(token: Annotated[str, Depends(OAUTH2_SCHEME)]):
token.split()[1],
PUBLIC_KEY,
algorithms=["RS256"],
# audience=["master-realm", "account"],
)
except jwt.InvalidTokenError:
raise credentials_exception
2 changes: 0 additions & 2 deletions frontend/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ const routes: RouteRecordRaw[] = [
component: ExpertSituation,
beforeEnter: (to, from, next) => {
mgr.getUser().then((user) => {
console.log(user);
if (user === null) {
mgr.signinRedirect();
} else {
Expand All @@ -216,7 +215,6 @@ const routes: RouteRecordRaw[] = [
component: ExpertiseForm,
beforeEnter: (to, from, next) => {
mgr.getUser().then((user) => {
console.log(user);
if (user === null) {
mgr.signinRedirect();
} else {
Expand Down
1 change: 0 additions & 1 deletion frontend/src/utils/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ export const mgr = new UserManager({
post_logout_redirect_uri: `${FRONTEND_URL}`,
response_type: "code",
scope: "openid profile email",
automaticSilentRenew: false,
});
10 changes: 2 additions & 8 deletions frontend/src/views/GuideAskingExpertise/ExpertiseForm.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<div>
<div class="fr-container fr-col-12">
<h1 class="fr-mt-3w flex justify-center titlePage">
<div>Questionnaire demande</div>
<div><span style="color: blue"> d'avis</span></div>
</h1>

<div class="fr-col-11 fr-col-lg-6 mx-auto">
<div class="fr-col-12 fr-col-lg-6 mx-auto">
<div class="fr-mb-5w">
<StepsGuide
class="!fr-container"
Expand Down Expand Up @@ -437,10 +437,6 @@ const getUserData = async () => {
phone.value = user.profile.phone_number;
seizure.value = todayDate;
getAccessToken.value = user?.access_token;
console.log(
"Données de l'utilisateur récupérées avec succès :",
user?.access_token,
);
} catch (error) {
console.error(
"Erreur pendant la récupération des données de l'utilisateur :",
Expand Down Expand Up @@ -520,9 +516,7 @@ const stepFormMappings = {
};
const handleFileChange = (newFiles: FileList) => {
console.log(newFiles); // eslint-disable-line no-console
files.value = files.value.concat(Array.from(newFiles));
console.log(files);
};
const getCurrentFormData = () => {
Expand Down
2 changes: 1 addition & 1 deletion keycloak/realm-export.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"defaultSignatureAlgorithm": "RS256",
"revokeRefreshToken": false,
"refreshTokenMaxReuse": 0,
"accessTokenLifespan": 60,
"accessTokenLifespan": 3600,
"accessTokenLifespanForImplicitFlow": 900,
"ssoSessionIdleTimeout": 1800,
"ssoSessionMaxLifespan": 36000,
Expand Down

0 comments on commit e2e7232

Please sign in to comment.