okta-challenge

Prerequisites


  • Java Installation (this example runs on JDK 12)
  • Maven
  • Create react app
  • Postman for testing
  • IDE of choice

0. Create an application in Okta


Register your application by selecting Applications > Add Application. On the next screen, choose Single Page App and click Next.

BaseURI: "http://localhost:8080"
LoginRedirect URI: "http://localhost:8080/login/callback"
LogoutRedirect URI: "http://localhost:8080"

1. Set up your environment variables

While there are many other possible environment variables that can / should be set to secure your app, below contains the minimum to get started

ISSUER= "https://yourOktaDomain.com/oauth2/default"
CLIENT_ID= "123xxxxx123"
JAVA_HOME= /path/to/your/jdk

2. React front end

cd custom-login
npm install
npm start

3. Set up the resource server

cd resource-server
mvn -Dokta.oauth2.issuer=https://{yourOktaDomain}/oauth2/default

4. If needed, set up a proxy for HTTP requests

I used CORS Anywhere