mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 12:52:24 -06:00
[feature] add 'state' oauth2 param to /oauth/authorize (#730)
This commit is contained in:
parent
7ca5bac7c6
commit
8106b69856
6 changed files with 35 additions and 20 deletions
|
|
@ -58,16 +58,16 @@ func (m *Module) SignInGETHandler(c *gin.Context) {
|
|||
// idp provider is in use, so redirect to it
|
||||
s := sessions.Default(c)
|
||||
|
||||
stateI := s.Get(sessionState)
|
||||
state, ok := stateI.(string)
|
||||
internalStateI := s.Get(sessionInternalState)
|
||||
internalState, ok := internalStateI.(string)
|
||||
if !ok {
|
||||
m.clearSession(s)
|
||||
err := fmt.Errorf("key %s was not found in session", sessionState)
|
||||
err := fmt.Errorf("key %s was not found in session", sessionInternalState)
|
||||
api.ErrorHandler(c, gtserror.NewErrorBadRequest(err, err.Error()), m.processor.InstanceGet)
|
||||
return
|
||||
}
|
||||
|
||||
c.Redirect(http.StatusSeeOther, m.idp.AuthCodeURL(state))
|
||||
c.Redirect(http.StatusSeeOther, m.idp.AuthCodeURL(internalState))
|
||||
}
|
||||
|
||||
// SignInPOSTHandler should be served at https://example.org/auth/sign_in.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue