Kotlin and TypeScript Notes Example
This example app shows how to build a basic notes app with Kotlin, Spring Boot, Spring Data, TypeScript, and Angular.
Please read Build a Secure Notes Application with Kotlin, TypeScript, and Okta to see how this app was created.
Prerequisites: Java 8 and Node.js.
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 https://github.com/oktadeveloper/okta-kotlin-typescript-notes-example.git
cd okta-kotlin-typescript-notes-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.
To run the server, cd into the server
folder and run:
./mvnw
To run the client, cd into the client
folder and run:
yarn && yarn start
Create an OIDC App in Okta
You will need to create an OIDC App in Okta to get a clientId
.
Log in to your Okta Developer account (or sign up if you don’t have an account) and navigate to Applications and click on Add Application. Select Single Page App (SPA) and click Next. Give the application a name (e.g. “My OIDC App”) and specify http://localhost:4200
as a Login redirect URI. Click Done and admire your handiwork!
Server Configuration
Set the issuer
and copy the clientId
into server/src/main/resources/application.properties
.
NOTE: The value of {yourOktaDomain}
should be something like dev-123456.oktapreview
. Make sure you don't include -admin
in the value!
okta.oauth.issuer=https://{yourOktaDomain}.com/oauth2/default
okta.oauth.clientId={clientId}
Client Configuration
For the client, set the issuer
and copy the clientId
into client/src/app/shared/okta.service.ts
.
signIn = new OktaSignIn({
baseUrl: 'https://{yourOktaDomain}.com',
clientId: '{clientId}',
redirectUri: 'http://localhost:4200',
authParams: {
issuer: 'default',
responseType: ['id_token', 'token'],
scopes: ['openid', 'email', 'profile']
}
});
NOTE: There’s one issue with Okta’s Sign-In Widget I still haven’t fully figured out. Not every time, but everyone once it in a while, it requires me to move my mouse or click on the screen to make the notes list load after logging in. I opened an issue for this, and tried the suggested solution, but it doesn’t work 100% of the time.
Links
This example uses the following libraries provided by Okta:
Help
Please post any questions as comments on the blog post, or visit our Okta Developer Forums. You can also email [email protected] if would like to create a support ticket.
License
Apache 2.0, see LICENSE.