Before running this sample, you will need an Okta Developer Account. Create one using okta register
, or configure an existing one with okta login
.
- Login to your Okta Admin dashboard, e.g. (https://my-account-admin.okta.com/admin/dashboard)
- Navigate to
Applications > Applications
in the left-hand menu. - Click
Create App Integration
. - For
Sign-in method
selectOIDC - OpenID Connect
and forApplication Type
selectWeb Application
. ClickNext
. - Use the following values for application info:
- For
App integration name
useokta-php-app-quickstart
. - Select
Grant type > Core grants > Refresh Token
. - Select
Assignments > Controlled access > Skip group assignment for now
. - Leave all other values as default.
- For
composer install
- Copy the file
.env.example
to.env
and fill in your Okta app configuration.OKTA_OAUTH2_ISSUER
: usehttps://{myOktaDomain}/oauth2/default
.OKTA_OAUTH2_CLIENT_ID
: use the value inClient Credentials > Client ID
.OKTA_OAUTH2_CLIENT_SECRET
: use the only value inCLIENT SECRETS
.OKTA_OAUTH2_REDIRECT_URI
: use the default value (http://localhost:8080/authorization-code/callback
).
Run the app with the built-in PHP server:
php -S 127.0.0.1:8080 -t public
Visit http://localhost:8080
in your browser and you should be able to sign in.