Skip to content
Discussion options

You must be logged in to vote

Hi @kevinclancy my favorite way is to store them in a secure http only cookie.

You can do it by changing the config
For example in config/development.yaml

auth:
  # JWT authentication
  jwt:
    # Secret key for token generation and verification
    secret: vqc6o8vyjB2BtxUT3TOM
    # Token expiration time in seconds
    expiration: 604800 # 7 days
    location:
      from: Cookie
      name: jwt

the name is the name of the cookie where the jwt will be stored.

And this is the way i setup the cookie:

#[debug_handler]
async fn login_admin(
    State(ctx): State<AppContext>,
    jar: CookieJar,
    Json(params): Json<LoginParams>,
) -> Result<(CookieJar, Response)> {
    let user = users::Model…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by kevinclancy
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants