ci: docker_tag=ext feat(front): callback bridge authorized-bridge; bump 0.1.6; changelog
All checks were successful
build-and-push-ext / build_push (push) Successful in 1m31s
All checks were successful
build-and-push-ext / build_push (push) Successful in 1m31s
This commit is contained in:
parent
387e7ed65c
commit
5af06c76f6
@ -26,3 +26,10 @@
|
|||||||
- Next.js `output: 'standalone'` pour une image runtime plus légère.
|
- Next.js `output: 'standalone'` pour une image runtime plus légère.
|
||||||
- Caches BuildKit (npm et .next) pour accélérer les builds.
|
- Caches BuildKit (npm et .next) pour accélérer les builds.
|
||||||
- Runtime basé sur `server.js` (standalone) au lieu de `next start`.
|
- Runtime basé sur `server.js` (standalone) au lieu de `next start`.
|
||||||
|
|
||||||
|
## v0.1.6
|
||||||
|
|
||||||
|
- Mise en place d’un "callback bridge" pour IdNot:
|
||||||
|
- Page bridge côté domaine autorisé (`/authorized-client`) qui POST le `code` vers `/api/v1/idnot/auth` et redirige.
|
||||||
|
- Page front `/lecoffre/authorized-bridge` qui consomme `#token`/`#error`, stocke le cookie et redirige vers le tableau de bord.
|
||||||
|
- Permet le login sans modifier la liste des callbacks autorisés chez IdNot.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lecoffre-front",
|
"name": "lecoffre-front",
|
||||||
"version": "0.1.5",
|
"version": "0.1.6",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev",
|
"dev": "next dev",
|
||||||
@ -37,7 +37,7 @@
|
|||||||
"react": "18.2.0",
|
"react": "18.2.0",
|
||||||
"react-dom": "18.2.0",
|
"react-dom": "18.2.0",
|
||||||
"react-gtm-module": "^2.0.11",
|
"react-gtm-module": "^2.0.11",
|
||||||
|
|
||||||
"react-select": "^5.7.2",
|
"react-select": "^5.7.2",
|
||||||
"react-toastify": "^9.1.3",
|
"react-toastify": "^9.1.3",
|
||||||
"sass": "^1.59.2",
|
"sass": "^1.59.2",
|
||||||
|
33
src/pages/authorized-bridge.tsx
Normal file
33
src/pages/authorized-bridge.tsx
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import { useEffect } from 'react';
|
||||||
|
import { useRouter } from 'next/router';
|
||||||
|
import Module from '@Front/Config/Module';
|
||||||
|
import CookieService from '@Front/Services/CookieService/CookieService';
|
||||||
|
|
||||||
|
export default function AuthorizedBridge() {
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
try {
|
||||||
|
const hash = typeof window !== 'undefined' ? window.location.hash : '';
|
||||||
|
const params = new URLSearchParams(hash.replace(/^#/, ''));
|
||||||
|
const token = params.get('token');
|
||||||
|
const error = params.get('error');
|
||||||
|
|
||||||
|
if (token) {
|
||||||
|
CookieService.getInstance().setCookie('leCoffreAccessToken', token);
|
||||||
|
// Aller sur le tableau de bord
|
||||||
|
window.location.replace(Module.getInstance().get().modules.pages.Folder.props.path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// En cas d'erreur, renvoyer vers la page login avec un code générique
|
||||||
|
const loginPath = Module.getInstance().get().modules.pages.Login.props.path;
|
||||||
|
router.replace(`${loginPath}?error=${encodeURIComponent(error || '1')}`);
|
||||||
|
} catch (_e) {
|
||||||
|
const loginPath = Module.getInstance().get().modules.pages.Login.props.path;
|
||||||
|
router.replace(`${loginPath}?error=1`);
|
||||||
|
}
|
||||||
|
}, [router]);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user