This project was created as an example of a full-fledged implementation of JWT(with access and refresh tokens) in Ktor. Project contains registration by credentials, JWT authentication, refreshing expired token and auth-provided endpoints.
- User authentication by the email and password;
- JSON forms validation;
- Registration of users;
- Issuing a pair of a refresh and access tokens;
- Automatic creation of missing tables in the database;
- Refreshing a pair of tokens using a refresh token.
- Kotlin
1.5.21
- Ktor server
1.6.2
- Exposed
0.32.1
- Logback
1.2.5
- SQLite JDBC Driver
0.36.0
- Bcrypt
1.0.9
- Konform
0.3.0
- ShadowJar
6.1.0
Clone the repository:
$ git clone https://github.com/Slenkis/ktor-full-jwt.git
Navigate to the repository folder:
$ cd ktor-full-jwt
Run application:
$ ./gradlew run
Method | Endpoint | Wiki page |
---|---|---|
POST | /api/registration |
User registration |
POST | /api/login |
User authentication |
POST | /api/refresh |
Refresh token |
GET | /users/me |
Get user info |
Read about configuration, table schemes and more in Wiki
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.
Project is licensing under Apache-2.0