Skip to content

How not to send the state parameter? #174

@amessinger

Description

@amessinger

Hi there! Thanks for creating & maintaining this gem :)

I'd like to prevent this client from sending the state parameter during the request phase because in some cases I can't rely on the session to store it.

I thought the require_state config option set to false would do the trick but it seems to be used only for validation during the callback phase :

invalid_state = (options.require_state && params['state'].to_s.empty?) || params['state'] != stored_state
)

From what I understand, the state parameter is still sent during the request phase, the identity provider forwards it back to the callback URL and this state value in the URL's parameters, though valid, can't be matched to the session's state value since the session is not available.

Couldn't the creation of the state parameter be made conditionally to the value of the require_state config option?

          [..]
          state: (new_state if options.require_state),
          [...]

Any help would be appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions