diff --git a/src/app/api/idnot/UserController.ts b/src/app/api/idnot/UserController.ts index cac75ffc..60d13059 100644 --- a/src/app/api/idnot/UserController.ts +++ b/src/app/api/idnot/UserController.ts @@ -22,7 +22,7 @@ export default class UserController extends ApiController { protected async getUserInfosFromIdnot(req: Request, response: Response) { try { const code = req.params["code"]; - if (!code) throw new Error("code is required"); + if (!code) throw new Error("code is required"); const idNotToken = await this.idNotService.getIdNotToken(code); if(!idNotToken) { diff --git a/src/services/common/IdNotService/IdNotService.ts b/src/services/common/IdNotService/IdNotService.ts index 7b403836..dd15912e 100644 --- a/src/services/common/IdNotService/IdNotService.ts +++ b/src/services/common/IdNotService/IdNotService.ts @@ -117,11 +117,14 @@ export default class IdNotService extends BaseService { const query = new URLSearchParams({ client_id: this.variables.IDNOT_CLIENT_ID, client_secret: this.variables.IDNOT_CLIENT_SECRET, - redirect_uri: `${this.variables.APP_HOST}/authorized-client`, + redirect_uri: this.variables.IDNOT_REDIRECT_URL, code: code, grant_type: "authorization_code", - }); + }); + const token = await fetch(this.variables.IDNOT_BASE_URL + this.variables.IDNOT_CONNEXION_URL + "?" + query, { method: "POST" }); + if(token.status !== 200) console.error(await token.text()); + const decodedToken = (await token.json()) as IIdNotToken; const decodedIdToken = jwt.decode(decodedToken.id_token) as IdNotJwtPayload;