handle oauth token scope, fix user.SigninCount + token.UserID

Signed-off-by: kim (grufwub) <grufwub@gmail.com>
This commit is contained in:
kim (grufwub)
2021-09-08 20:46:08 +01:00
parent fce3ba6382
commit d2a85f2f5f
3 changed files with 6 additions and 2 deletions

View File

@ -31,6 +31,7 @@ type tokenBody struct {
Code *string `form:"code" json:"code" xml:"code"`
GrantType *string `form:"grant_type" json:"grant_type" xml:"grant_type"`
RedirectURI *string `form:"redirect_uri" json:"redirect_uri" xml:"redirect_uri"`
Scope *string `form:"scope" json:"scope" xml:"scope"`
}
// TokenPOSTHandler should be served as a POST at https://example.org/oauth/token
@ -58,6 +59,9 @@ func (m *Module) TokenPOSTHandler(c *gin.Context) {
if form.RedirectURI != nil {
c.Request.Form.Set("redirect_uri", *form.RedirectURI)
}
if form.Scope != nil {
c.Request.Form.Set("scope", *form.Scope)
}
}
if err := m.server.HandleTokenRequest(c.Writer, c.Request); err != nil {