-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Improve error message when invalid content-type for UserInfo response #8764
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
Comments
It looks like you have posted this question on StackOverflow, so let's continue the discussion there. |
@eleftherias I have opened this issue over here because it looks like a potential bug to me as I havent added much of my code. If you run the sample provided |
@sachin21jan I have reopened this issue and we will take another look at it. |
@sachin21jan The issue here is a misconfiguration in Given your However, the I would encourage you to go through the reference doc to get more into the details on OAuth 2.0 Login or you might be looking for the OAuth 2.0 Authorization Code Grant, if you're simply looking to access the Contacts API (and not login). |
@jgrandja I wonder if we could improve the error message? Perhaps including the response in the error message and explaining it doesn't confirm to the user info endpoint? |
@rwinch Sure, it would be better to improve the error message. The previous message was:
The updated message is:
|
Summary
Adding scope: https://www.googleapis.com/auth/contacts.readonly to google oauth2 login generating following exception -
org.springframework.security.oauth2.core.OAuth2AuthenticationException: [invalid_user_info_response] An error occurred while attempting to retrieve the UserInfo Resource: Could not extract response: no suitable HttpMessageConverter found for response type [java.util.Map<java.lang.String, java.lang.Object>] and content type [text/plain]
Actual Behavior
I am able to authenticate and authorize user without giving any scope but as soon as I add scope: https://www.googleapis.com/auth/contacts.readonly in application.yml, its throwing Could not extract response: no suitable HttpMessageConverter found for response type [java.util.Map<java.lang.String, java.lang.Object>] and content type [text/plain] exception.
Expected Behavior
It shouldnt have thrown the exception
Configuration
application.yml
oauth2:
client:
registration:
google:
client-id: <>
client-secret: <>
scope: https://www.googleapis.com/auth/contacts.readonly
provider:
google:
user-info-uri: https://www.googleapis.com/auth/contacts.readonly?alt=json
Version
I am using Spring boot 2.3.0.RELEASE and Spring security 5.3.2.RELEASE
The text was updated successfully, but these errors were encountered: