appleboy / gin-jwt

JWT Middleware for Gin framework
MIT License
2.73k stars 382 forks source link

How to get token in register handler? #291

Open ce2cs opened 2 years ago

ce2cs commented 2 years ago

New to web development. I was wondering how to get token if I need respond token in register API. I do not use the middleware in register router we cannot get a token before we register an account.

storytellerGIT commented 2 years ago

you may have a look at func (mw *GinJWTMiddleware) TokenGenerator(data interface{}) (string, time.Time, error)

Starballoon commented 2 years ago

I guess that you have joined the training camp organized by ByteDance also. The framework gin has designed a chain call API, which means you can call the LoginHandler of this project after calling register function that has already registered the user somewhere.