Skip to content

An example of how to use JWT authentication with Go Gin and SvelteKit using cookies(*inside SvelteKit*)

Notifications You must be signed in to change notification settings

thegeorgenikhil/go-gin-sveltekit-jwt-cookie-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Gin + SvelteKit - JWT Authentication Example using Cookies

An example of how to use JWT authentication with Go Gin and SvelteKit using cookies. The server returns the jwt token in response body and inside SvelteKit we store it in a cookie. The cookie is sent with every request to the server(SvelteKit) when using SSR.

Setup

Install dependencies

# Installing the node dependencies for the frontend
make install_frontend

# Installing the go dependencies for the server
make install_server

Start the server

make server

Start the client

make frontend

Routes

Route Method Request Body Description
/auth/login POST email + password Login route, returns a jwt token + message
/auth/signup POST email + password Signup route, returns a jwt token + message
/user/get-my-id GET none Returns the id of the user, needs Authorization header with the jwt token

About

An example of how to use JWT authentication with Go Gin and SvelteKit using cookies(*inside SvelteKit*)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published