feat(idnot): garde anti-vide sur redirect_uri avec warning + fallback
Some checks failed
build-and-push-ext / build_push (push) Has been cancelled
Some checks failed
build-and-push-ext / build_push (push) Has been cancelled
This commit is contained in:
parent
7315c16329
commit
233c352359
@ -5,7 +5,7 @@ NODE_ENV=production
|
||||
# Configuration IDNOT
|
||||
IDNOT_ANNUARY_BASE_URL=https://qual-api.notaires.fr/annuaire
|
||||
# IDNOT_REDIRECT_URI=http://local.4nkweb.com:3004/authorized-client
|
||||
IDNOT_REDIRECT_URI=https://dev4.4nkweb.com/lecoffre/authorized-client
|
||||
IDNOT_REDIRECT_URI=http://local.lecoffreio.4nkweb:3000/authorized-client
|
||||
IDNOT_TOKEN_URL=https://qual-connexion.idnot.fr/user/IdPOAuth2/token/idnot_idp_v1
|
||||
IDNOT_API_BASE_URL=https://qual-api.notaires.fr/annuaire
|
||||
|
||||
|
@ -27,7 +27,11 @@ export default class Auth extends BaseApiService {
|
||||
|
||||
public async loginWithIdNot() {
|
||||
const variables = FrontendVariables.getInstance();
|
||||
const redirectUri = variables.IDNOT_REDIRECT_URI || `${variables.FRONT_APP_HOST}/authorized-client`;
|
||||
let redirectUri = variables.IDNOT_REDIRECT_URI || "";
|
||||
if (!redirectUri) {
|
||||
console.warn("[IDNOT] NEXT_PUBLIC_IDNOT_REDIRECT_URI vide; fallback sur FRONT_APP_HOST/authorized-client");
|
||||
redirectUri = `${variables.FRONT_APP_HOST}/authorized-client`;
|
||||
}
|
||||
const url = new URL(
|
||||
`${variables.IDNOT_BASE_URL + variables.IDNOT_AUTHORIZE_ENDPOINT}?client_id=${variables.IDNOT_CLIENT_ID}&redirect_uri=${redirectUri}&scope=openid,profile&response_type=code`,
|
||||
);
|
||||
|
@ -43,7 +43,11 @@ export default function StepEmail(props: IProps) {
|
||||
const error = router.query["error"];
|
||||
const redirectUserOnConnection = useCallback(() => {
|
||||
const variables = FrontendVariables.getInstance();
|
||||
const redirectUri = variables.IDNOT_REDIRECT_URI || `${variables.FRONT_APP_HOST}/authorized-client`;
|
||||
let redirectUri = variables.IDNOT_REDIRECT_URI || "";
|
||||
if (!redirectUri) {
|
||||
console.warn("[IDNOT] NEXT_PUBLIC_IDNOT_REDIRECT_URI vide; fallback sur FRONT_APP_HOST/authorized-client");
|
||||
redirectUri = `${variables.FRONT_APP_HOST}/authorized-client`;
|
||||
}
|
||||
const authorizeBase = `${variables.IDNOT_BASE_URL}${variables.IDNOT_AUTHORIZE_ENDPOINT}`;
|
||||
router.push(
|
||||
`${authorizeBase}?client_id=${variables.IDNOT_CLIENT_ID}&redirect_uri=${encodeURIComponent(redirectUri)}&scope=openid,profile&response_type=code`,
|
||||
|
Loading…
x
Reference in New Issue
Block a user