PHP Authorization with OAuth 2.0 and Okta

PHP Authorization with OAuth 2.0 and Okta

Learn how to use groups and roles to control who has access to your application

charles3001

Good day, cloned the App from github onto my Cent/OS 6.10 Linux running PHP 5.6.40. I have created a proper OKTA account, but when I run the app, it returns the following error:

[prsuser@localhost okta-php-core-login-example]$ php -S 192.168.1.238:8080 -t public
PHP 5.6.40 Development Server started at Tue Dec 17 06:32:11 2019
Listening on http://192.168.1.238:8080
Document root is /home/prsuser/okta-php-core-login-example/public
Press Ctrl-C to quit.
[Tue Dec 17 06:32:20 2019] PHP Fatal error: Class ‘Src\Services\OktaApiService’ not found in /home/prsuser/okta-php-core-login-example/public/index.php on line 7
[Tue Dec 17 06:32:20 2019] 192.168.1.180:12462 [500]: / - Class ‘Src\Services\OktaApiService’ not found in /home/prsuser/okta-php-core-login-example/public/index.php on line 7

Why would this be occurring?

Krasimir Hristozov

Hi,

It appears that the autoloading is not working. Did you run ‘composer install’? Also, note that PHP 5.6 is obsolete and I haven’t really tested the code against PHP 5 at all (PHP 7 is highly recommended).

Sanjeev

Hi,
I am getting the error when fetching the groups, the function - oktaApiGet() throws error - {“errorCode”:“E0000011”,“errorSummary”:"Invalid token provided “,” errorLink ": “E0000011”, “errorId”: “oaed6sfwLkKRCyieFJcINTJRA”, “errorCauses”: }

Krasimir Hristozov

It’s difficult to help with just this information. Does everything else work, and you get this error only when fetching the groups?

Anaan Ramay

Is there a way to assign a specific group on user registration using the form that we’ve built in this?