Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Oauth assertion failing? #38

Open
waclock opened this issue Feb 13, 2023 · 1 comment
Open

Google Oauth assertion failing? #38

waclock opened this issue Feb 13, 2023 · 1 comment

Comments

@waclock
Copy link

waclock commented Feb 13, 2023

Hello,

I'm having trouble setting up grants_assertion with google. I've setup doorkeeper and currently have a react-native app that is getting an idToken, accessToken and code. This is doing so, by using a specific iOS Client ID.

I'm then sending the idToken as the assertion to be checked by doorkeeper, like so:

Doorkeeper.configure do
  resource_owner_from_assertion do
    if server.client && params[:provider] && params[:assertion]
      auth = Doorkeeper::GrantsAssertion::Devise::OmniAuth.auth_hash(
        provider: params.fetch(:provider),
        assertion: params.fetch(:assertion)
      )
      User.where(email: auth.info.email).first if auth
    end
  end
  # add your supported grant types and other extensions
  grant_flows %w(assertion authorization_code implicit password client_credentials)
end

I've setup as my env variables in rails a specific Client ID and client secret for my rails server. However, every time I try validating the passed assertion, I get the following error:

{
  "error_description": "Invalid Value"
}

I've tried passing the idToken, accessToken and also directly calling Doorkeeper::GrantsAssertion::OmniAuth.oauth2_wrapper with different combinations of client_id and client_secret, but unfortunately nothing has worked so far.
I'm using rails 7 and ruby 3. Is this library still working with Google Oauth? Any help would be appreciated, thanks.

@1997roylee
Copy link
Contributor

I faced this problem and I decided to create a google auth service to validate the auth code to solve this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants