Skip to content

oktadev/okta-kotlin-spring-boot-vue-example

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A CRUD Example App with Vue, Spring Boot, and Kotlin

This example app shows how to build a basic CRUD app with Spring Boot Kotlin, Spring Data, and Vue.js. Please read Build a CRUD App with Vue.js, Spring Boot, and Kotlin to see how this app was created.

Prerequisites:

Okta has Authentication and User Management APIs that reduce development time with instant-on, scalable user infrastructure. Okta's intuitive API and expert support make it easy for developers to authenticate, manage and secure users and roles in any application.

Getting Started

To install this example application, run the following commands:

git clone -b auth https://github.com/oktadeveloper/okta-kotlin-spring-boot-vue-example.git
cd okta-kotlin-spring-boot-vue-example

This will get a copy of the project installed locally. To install all of its dependencies and start each app, follow the instructions below.

Spring Boot Configuration

To create a new OIDC app for Spring Boot on Okta:

  1. Log in to your developer account, navigate to Applications, and click on Add Application.
  2. Select Web and click Next.
  3. Give the application a name and add http://localhost:9000/login/oauth2/code/okta as a login redirect URI.
  4. Click Done.

Add your issuer and client ID to server/src/main/resources/application.properties.

okta.oauth2.issuer=https://$YOUR_OKTA_DOMAIN/oauth2/default
okta.oauth2.clientId=$YOUR_CLIENT_ID

NOTE: The value of $YOUR_OKTA_DOMAIN should be something like dev-123456.okta.com. Make sure you don't include -admin in the value!

Start your Spring Boot app by navigating to the server directory and starting your app.

cd server
./gradlew bootRun

Vue Configuration

To create a new OIDC app for Vue on Okta:

  1. Log in to your developer account, navigate to Applications, and click on Add Application.
  2. Select Single-Page App and click Next.
  3. Give the application a name, set the login redirect URI to http://localhost:8080/callback, and click Done.

Copy the issuer and clientId into client/src/router.js.

Vue.use(Auth, {
   issuer: 'https://$YOUR_OKTA_DOMAIN/oauth2/default',
   clientId: '$YOUR_CLIENT_ID',
   redirectUri: window.location.origin + '/callback'
});

Navigate into the client folder and run:

npm install && yarn serve

Open your browser to http://localhost:8080, log in, and create todos to your hearts content!

Links

This example uses the following open source libraries from Okta:

Help

Please post any questions as comments on the blog post, or visit our Okta Developer Forums.

License

Apache 2.0, see LICENSE.

Languages

  • Vue 35.0%
  • CSS 34.8%
  • Kotlin 21.9%
  • JavaScript 5.2%
  • HTML 3.1%