appleboy/gin-jwt

How to get token in register handler?

ce2cs opened this issue · 2 comments

ce2cs commented

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.

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

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.