Skip to content

google_oauth2 Authentication failure! csrf_detected: OmniAuth::Strategies::OAuth2::CallbackError, csrf_detected | CSRF detected #58

Closed
@gdurelle

Description

@gdurelle

Even when creating the state myself it got the same error.

session['omniauth.state'] =  SecureRandom.hex(24)
redirect_to "/auth/google_oauth2?state=#{session['omniauth.state']}"

Even though the returned state is the same, meaning it should match !

Isn't there a double redirect or something ?
Because if so the :

request.params['state'] != session.delete('omniauth.state')

in https://github.com/intridea/omniauth-oauth2/blob/master/lib/omniauth/strategies/oauth2.rb#L72 would explain the problem.
=> First passes, second fail.

https://stackoverflow.com/questions/22386149/why-am-i-getting-csrf-detected-with-omniauth-and-google/23739564#23739564

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