Skip to content

👉 Ktor based JWT Token provider for login purposes with Exposed framework and PostgreSQL

Notifications You must be signed in to change notification settings

mfarkan/ktor-jwt-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kotlin Ktor Server Version PostgreSQL Version

Welcome to Login API!

In this example repository, you will be able to see KTOR based backend application working with a couple of techniques ;

Installation

With docker compose, the application will be exposed on 9090 port with 5432 database connections.

docker compose build
docker compose up

Note: If you want to change ports of the configuration, please check Dockerfile and docker-compose.yml

Environment Configuration

In application.conf you will see some environment variables for test purposes. If you want to run this app in another circumstances, you should change these variables either in application.conf or Dockerfile.

  • PORT

    If you change this config, your application will be working on that port.

  • JWT_SECRET

    Secret for JWT creation.

  • DB_PASSWORD

    database password

  • DB_CONNECTION

    database connection string

  • DB_USERNAME

    database username

JWT UML

In the example below, you see Json Web Token Authentication between client and server.

sequenceDiagram
Client ->> Resource: Hello Resource, I want this data from you
Resource ->> Client: I don't know who you are(401)
Client ->> JWT Server: Hello, here is my username&password for data
JWT Server ->> Client: Okey, I know you. Here is your token(access_token)
Client ->> Resource: Here I am again with Bearer access_token
Resource ->> Client: Okey, I know you. This is your data(200)
Loading

Note: The Login API is working on current KTOR 2.0.1 version and working with dockerized PostgreSQL in development environment. If you want to use, please change configuration file inside resources file.

About

👉 Ktor based JWT Token provider for login purposes with Exposed framework and PostgreSQL

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published