Okta 400 bad request undefined OKTA_OAUTH2_REDIRECT_URI in $_ENV

Hi everybody,
I’m new user, and I’m testing this example “Sign users in to your web app using the redirect model | Okta Developer” (Sign users in to your web app using the redirect model | Okta Developer).
When I try to run I got this error


The OKTA_OAUTH2_REDIRECT_URI index of $_ENV array is undefined
image

And this is my application config:

Can someone help me resolve this plz ?

Hi @Anis! Can you please copy/paste/share the /authorize url in the browser when you get the 400 error? I want to see the url your app is calling. It must be a string match to what you have listed under your Sign-in-redirect URIs in Okta.

1 Like

Hi @sigama thx for your answear, do you mea the url I’ve when I got the error ?
This one ?
https://dev-75663139.okta.com/oauth2/default/v1/authorize?response_type=code&client_id=0oa826y3qhbJVKvMA5d7&state=8824a27fbcc282ea3024&code_challenge=fSTL_7ju4hjLuMAGmXs1asJ4pnc1wh2mjMINRyRDABI&code_challenge_method=S256&scope=openid+profile+email

here is a print screen of the error

Thank you @Anis that was what I was asking for. I don’t see the redirect uri coming through the /authorize call and that is required per - OpenID Connect & OAuth 2.0 API | Okta Developer. Can you double check why your app is not including this required parameter?

Hi @sigama thank you for your answear, I resolved this by adding OKTA_OAUTH2_REDIRECT_URI in my .env file: OKTA_OAUTH2_REDIRECT_URI=“http://localhost:8080/authorization-code/callback

Then I got the login form :+1:

Then when I tape my user name and password I got error, and when I check the code I realise that curl_exec returned false in the code below :+1:

$response is NULL (line 84) because curl_exec($ch) return FALSE :frowning:

Do you have any idea about that ?

the error of curl_exec is:
echo curl_error($ch); => SSL certificate problem: unable to get local issuer certificate
echo curl_errno($ch); => 60

@Anis please confirm this is not an issue with your SSL cert - curl: (60) SSL certificate problem: unable to get local issuer certificate - Stack Overflow.