casinthecloud / cas-oauth-demo-3.5.x

Demo webapps to test OAuth support (client and server) in CAS version 3.5.x (x >= 1)
14 stars 17 forks source link

Problem while login with Google provider #4

Closed astik closed 11 years ago

astik commented 11 years ago

Hi, I tried to log in with Google provider and it doesn't seem to work. Here is the log from what I get after validating the authentification iinto Google :

2013-07-26 18:57:10,819 ERROR [org.scribe.up.provider.BaseOAuthProvider] - <Failed to get user data, code : 404 / body : <!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 404 (Not Found)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}
  </style>
  <a href=//www.google.com/><img src=//www.google.com/images/errors/logo_sm.gif alt=Google></a>
  <p><b>404.</b> <ins>That’s an error.</ins>
  <p>The requested URL <code>/api/people/@me/@self</code> was not found on this server.  <ins>That’s all we know.</ins>
>
2013-07-26 18:57:10,819 INFO [org.jasig.cas.authentication.AuthenticationManagerImpl] - <org.jasig.cas.support.oauth.authentication.handler.support.OAuthAuthenticationHandler failed to authenticate org.jasig.cas.support.oauth.authentication.principal.OAuthCredentials@7c067f03>
2013-07-26 18:57:10,820 INFO [com.github.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN
=============================================================
WHO: org.jasig.cas.support.oauth.authentication.principal.OAuthCredentials@7c067f03
WHAT: supplied credentials: org.jasig.cas.support.oauth.authentication.principal.OAuthCredentials@7c067f03
ACTION: AUTHENTICATION_FAILED
APPLICATION: CAS
WHEN: Fri Jul 26 18:57:10 CEST 2013
CLIENT IP ADDRESS: 10.5.2.195
SERVER IP ADDRESS: 10.5.2.195
=============================================================

>
2013-07-26 18:57:10,821 INFO [com.github.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN
=============================================================
WHO: org.jasig.cas.support.oauth.authentication.principal.OAuthCredentials@7c067f03
WHAT: error.authentication.credentials.bad
ACTION: TICKET_GRANTING_TICKET_NOT_CREATED
APPLICATION: CAS
WHEN: Fri Jul 26 18:57:10 CEST 2013
CLIENT IP ADDRESS: 10.5.2.195
SERVER IP ADDRESS: 10.5.2.195
=============================================================
leleuj commented 11 years ago

You're right, the Google support does not work any more. In fact, Google has removed its OAuth 1.0 support and thus, the GoogleProvider cannot retrieve user data any more. The solution is to use the Google2Provider which uses the OAuth 2.0 protocol. This change is to be made in the https://github.com/leleuj/cas-oauth-demo-3.5.x/blob/master/cas-oauth-client-demo-3.5.x/src/main/webapp/WEB-INF/spring-configuration/applicationContext.xml file.

astik commented 11 years ago

Ok. I had it working with the cas-pac4j-oauth-client-demo, i think it should work the same on this one. One thing through. Google seems to be more restrictive on key / secret ... anonymous doesn't seems to work anymore. You'll have to create a real key for an identified service. I think it may be more secure but in development it's quite a PITA =D Thanks for you quick reply. (i'm closing the bug, but I think it would be better to remove the non-working example to not confuse people)

leleuj commented 11 years ago

Just removed none working examples : Google and LinkedIn...