You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to build an OAuth2 server. My access token (jwt type) server give me doesn't have iss (issuer) field. How can I add it to my token and another fields in payload? This is my server config and token server give me
manager=manage.NewDefaultManager()
cfg:=&manage.Config{
// access token expiration timeAccessTokenExp: time.Hour*2,
// refresh token expiration timeRefreshTokenExp: time.Hour*24*3,
// whether to generate the refreshing tokenIsGenerateRefresh: true,
}
manager.SetAuthorizeCodeTokenCfg(cfg)
manager.SetAuthorizeCodeExp(time.Minute*30)
manager.MapAuthorizeGenerate(generates.NewAuthorizeGenerate())
// generate jwt access tokenmanager.MapAccessGenerate(generates.NewJWTAccessGenerate([]byte("12345678"), jwt.SigningMethodHS256))
manager.MustTokenStorage(store.NewMemoryTokenStore())
clientStore=store.NewClientStore()
manager.MapClientStorage(clientStore)
srv=server.NewDefaultServer(manager)
srv.SetAllowGetAccessRequest(true)
// allow the grant types model:AuthorizationCode,PasswordCredentials,ClientCredentials,Refreshingsrv.SetAllowedGrantType("authorization_code")
// get client id and secrect, this is default handlersrv.SetClientInfoHandler(server.ClientFormHandler)
// way to get user IDsrv.SetUserAuthorizationHandler(userAuthorizeHandler)
//srv.SetExtensionFieldsHandler(extensionFieldsHanler)
manager.SetRefreshTokenCfg(manage.DefaultRefreshTokenCfg)
srv.SetInternalErrorHandler(func(errerror) (re*errors.Response) {
log.Println("Internal Error:", err.Error())
return
})
srv.SetResponseErrorHandler(func(re*errors.Response) {
log.Println("Response Error:", re.Error.Error())
})
I tried to find is api docs but I found nothing i tried config here https://go-oauth2.github.io/ but looklike "manager.MapTokenModel(models.NewToken())" doesn't work anymore, I dont know if it can help me
So I need some way to add more filed to my token. Thank for your help
The text was updated successfully, but these errors were encountered:
I lookup this question and found some answers here https://github.com/go-oauth2/oauth2/issues/98
But i want to ask if there is any option to customize field without change package data. Thank a lot
I'm trying to build an OAuth2 server. My access token (jwt type) server give me doesn't have iss (issuer) field. How can I add it to my token and another fields in payload? This is my server config and token server give me
https://i.stack.imgur.com/yDEy2.png
I tried to find is api docs but I found nothing i tried config here https://go-oauth2.github.io/ but looklike "manager.MapTokenModel(models.NewToken())" doesn't work anymore, I dont know if it can help me
So I need some way to add more filed to my token. Thank for your help
The text was updated successfully, but these errors were encountered: