The redirect URI you send is /signin/google , and it should be the same as the one configured in the Google API console - /connect/google
Hi ! Great initiative.
I've ran samples and everyting seems to work as expected, but facing an issue when integrating your quickstart project into spring-social-showcase: the redirect url is built without scope attribute. I've tested such generated url (using my custom client/private ids) and works if I manually add the scope attribute.
Do you have any clue ?
Regards.
Hi Gabriel,
Thanks for the quick reply. I've made the changes in the Google API Console but still no joy. Is there any way to get more info on why it's not working? Access denied is a pretty limited piece of info.
Cheers,
Marc
I've built the quickstart example using mvn clean, then mvn install. I dropped the war file into tomcat 7. When I attempt to login, I get the following exception when the oauth callback is invoked:
java.lang.NoSuchMethodError: org.springframework.web.client.RestTemplate.setInt erceptors([Lorg/springframework/http/client/ClientHttpRequestInterceptor;)V
org.springframework.social.oauth2.ProtectedResourc eClientFactory.create(ProtectedResourceClientFacto ry.java:36)
org.springframework.social.oauth2.AbstractOAuth2Ap iBinding.<init>(AbstractOAuth2ApiBinding.java:56)
org.springframework.social.google.api.impl.GoogleT emplate.<init>(GoogleTemplate.java:31)
org.springframework.social.google.connect.GoogleSe rviceProvider.getApi(GoogleServiceProvider.java:15 )
org.springframework.social.google.connect.GoogleSe rviceProvider.getApi(GoogleServiceProvider.java:7)
org.springframework.social.connect.support.OAuth2C onnection.initApi(OAuth2Connection.java:132)
org.springframework.social.connect.support.OAuth2C onnection.<init>(OAuth2Connection.java:71)
org.springframework.social.connect.support.OAuth2C onnectionFactory.createConnection(OAuth2Connection Factory.java:58)
org.springframework.social.connect.web.ConnectSupp ort.completeConnection(ConnectSupport.java:127)
org.springframework.social.connect.web.ProviderSig nInController.oauth2Callback(ProviderSignInControl ler.java:162)
I also noticed that the war file did not contain the localhost.properties file which I've manually added to the exploded war file. (I've updated the properties file to use my own client id and secret).
The war file has the following jar files:
aopalliance-1.0.jar
cglib-nodep-2.2.jar
cloudfoundry-runtime-0.6.0.jar
commons-io-2.0.1.jar
commons-logging-1.1.1.jar
dom4j-1.6.1.jar
h2-1.3.158.jar
jackson-core-asl-1.8.5.jar
jackson-mapper-asl-1.8.5.jar
javax.inject-1.jar
jaxen-1.1.1.jar
jdom-1.0.jar
jstl-api-1.2.jar
jstl-impl-1.2.jar
spring-aop-3.1.0.BUILD-20110905.072223-365.jar
spring-asm-3.1.0.BUILD-20110905.072138-367.jar
spring-beans-3.1.0.BUILD-20110905.072215-365.jar
spring-context-3.1.0.BUILD-20110905.072231-365.jar
spring-context-support-3.1.0.BUILD-20110905.072326-364.jar
spring-core-3.1.0.BUILD-20110905.072159-365.jar
spring-expression-3.1.0.BUILD-20110905.072208-365.jar
spring-jdbc-3.1.0.BUILD-20110905.072303-364.jar
spring-security-crypto-3.1.0.RC2.crypto.jar
spring-social-core-1.0.0.RC3.jar
spring-social-google-0.0.1-SNAPSHOT.jar
spring-social-web-1.0.0.RC3.jar
spring-tx-3.1.0.BUILD-20110905.072239-365.jar
spring-web-3.1.0.BUILD-20110905.072310-364.jar
spring-webmvc-3.1.0.BUILD-20110905.072340-364.jar
xalan-2.7.0.jar
xercesImpl-2.8.0.jar
xml-apis-1.3.03.jar
xom-1.2.5.jar
Does anything look amiss in terms of the libraries being pulled in? Any suggestions are appreciated.
Thank you,
David
Finally figured out my problem. I forgot to add the scope hidden parameter to the form
Ok, Google Social API is unfortunately not Spring 3.0 compatible.
I bomb on
ClientHttpRequestInterceptor[] interceptors = restTemplate.getInterceptors();
ClientHttpRequestInterceptor[] newInterceptors = new ClientHttpRequestInterceptor[interceptors.length+1];
System.arraycopy(interceptors, 0, newInterceptors, 0, interceptors.length);
newInterceptors[interceptors.length] = new GDataVersionInterceptor();
restTemplate.setInterceptors(newInterceptors);
I also hit an issue with setInterceptors (see my earlier post) and as best I can tell am only pulling in Spring 3.1.
The signature of the setInterceptors() method recently changed from taking an array of ClientHttpRequestInterceptor (as it was in Spring 3.1M2) to a List<ClientHttpRequestInterceptor> (in the latest snapshot builds). Spring Social was still using the 3.1M2 version of the method, which caused trouble if you're using a snapshot build of the Spring Framework. I could change Spring Social to fit the latest snapshots, but then you'd run into similar trouble when using Spring 3.1M2.
I've just pushed a snapshot build of Spring Social that resolves this issue to work with either Spring 3.1M2 or the latest Spring 3.1 snapshots. And it also should still work with Spring 3.0).
If using Spring 3.1M2, you can add the GDataVersionInterceptor like this:
But with Spring 3.1 snapshot it's simpler:Code:ClientHttpRequestInterceptor[] interceptors = restTemplate.getInterceptors(); ClientHttpRequestInterceptor[] newInterceptors = new ClientHttpRequestInterceptor[interceptors.length+1]; System.arraycopy(interceptors, 0, newInterceptors, 0, interceptors.length); newInterceptors[interceptors.length] = new GDataVersionInterceptor(); restTemplate.setInterceptors(newInterceptors);
Code:restTemplate.getInterceptors().add(new GDataVersionInterceptor());
Craig Walls
Spring Social Project Lead
Nice work
Considering that google has a vast library, wouldn't this be the case to split this into even smaller sub apis?
social-google-calendar
social-google-latitude
?
If that's the case I would like to help, I was building the foursquare api, but after doing some code, and finishing the UserProfile, I found out that there was already an initial implementation
Trying to find one social sub api to implement now
Regards