OAuth 42 Intra
During development, for OAuth to work, you will first need to:
- create an app on the intra.
- as the redirect URI, enter the following:
http://localhost:5173/oauth.
- as the redirect URI, enter the following:
- in the
.envfile which is located in the root of the project, place the following three variables:INTRA_API_UID=applicationUIDINTRA_API_SECRET=secretTokenSTATE_STRING=a_very_long_random_string_which_must_be_unguessable
- replace the value of the first two variables with your app’s UID and secret which you can find in your app’s page.
- replace (or not) the value of the third variable with an unguessable random string. It is used to protect against cross-site request forgery attacks.
- create an
.envfile inside the root of thefrontendfolder and place the following two variables in it:VITE_INTRA_API_AUTHORIZE_URL=auth_urlVITE_STATE_STRING=a_very_long_random_string_which_must_be_unguessable
- as the value of the first variable, you should write the long url that you can find in your app’s page (it looks like this but longer:
https://api.intra.42.fr/oauth/authorize/your_formatted_url). - as the value of the second variable, you should write the exact same string you put into the other
.env’sSTATE_STRINGvariable. - (if necessary, do not forget to bring down the docker-compose container and bring it back up)