fix(op): omit empty state from code flow redirect (#428)

* chore(op): reproduce issue #415

* fix(op): omit empty state from code flow redirect

Add test cases to reproduce the original bug, and it's resolution.

closes #415
This commit is contained in:
Tim Möhlmann 2023-08-18 16:03:51 +03:00 committed by GitHub
parent 45582b6ee9
commit 37b5de0e82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 134 additions and 5 deletions

View file

@ -448,11 +448,11 @@ func AuthResponseCode(w http.ResponseWriter, r *http.Request, authReq AuthReques
return
}
codeResponse := struct {
code string
state string
Code string `schema:"code"`
State string `schema:"state,omitempty"`
}{
code: code,
state: authReq.GetState(),
Code: code,
State: authReq.GetState(),
}
callback, err := AuthResponseURL(authReq.GetRedirectURI(), authReq.GetResponseType(), authReq.GetResponseMode(), &codeResponse, authorizer.Encoder())
if err != nil {