Skip to content

Commit

Permalink
Refactor the way we query the URL Query params
Browse files Browse the repository at this point in the history
  • Loading branch information
supercairos committed Dec 5, 2023
1 parent 7ad3851 commit 10419a9
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions device_user_request_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,10 @@ func (f *Fosite) NewDeviceUserRequest(ctx context.Context, r *http.Request) (_ D
func (f *Fosite) newDeviceUserRequest(ctx context.Context, r *http.Request) (DeviceUserRequester, error) {
request := NewDeviceUserRequest()
request.Lang = i18n.GetLangFromRequest(f.Config.GetMessageCatalog(ctx), r)
request.Form = r.URL.Query()

if err := r.ParseForm(); err != nil {
return nil, errorsx.WithStack(ErrInvalidRequest.WithHint("Unable to parse HTTP body, make sure to send a properly formatted form request body.").WithWrap(err).WithDebug(err.Error()))
}
request.Form = r.Form

verifier := request.GetRequestForm().Get("device_verifier")
if verifier != "" {
client, err := f.Store.GetClient(ctx, request.GetRequestForm().Get("client_id"))
if r.URL.Query().Has("device_verifier") {
client, err := f.Store.GetClient(ctx, r.URL.Query().Get("client_id"))
if err != nil {
return nil, errorsx.WithStack(ErrInvalidClient.WithHint("The requested OAuth 2.0 Client does not exist.").WithWrap(err).WithDebug(err.Error()))
}
Expand Down

0 comments on commit 10419a9

Please sign in to comment.