Praise is silver, contributing is gold
Praise is silver, contributing is gold
I'm curious how you get the refreshToken. Adding access_type=offline to the preConnect parameters doesn't seem to do the trick for me.
Marc: I replied to your question in the other thread...I figured it'd be best to continue carrying on the conversation there than to keep extending this thread.
Craig Walls
Spring Social Project Lead
Hey Craig,
Yes, I realize that. I sent it here because guznik is on this thread and I figured he must have dealt with this issue.
Cheers,
Marc
I'm not getting a refreshToken using the signinController but I am getting it using the connectController. I assume this is because I need to add access_type=offline to the request url. It's clear how to do this through the connect mechanism but not through the signin mechanism.
The way around it AFAIK is to write a custom controller that offers a special signin option for Google. Not very elegant to put it mildly.
The only problem I have is to get this Controller to work properly. Spring keeps trying to initialize it with a no-args constructor, even when I try to exclude annotations. Infuriating.@Controller
@RequestMapping("/signin")
public class MySignInController extends ProviderSignInController {
private final ConnectSupport webSupport = new ConnectSupport();
private final ConnectionFactoryLocator connectionFactoryLocator;
private final MultiValueMap<String,String> googleParams = new LinkedMultiValueMap<String,String>();
public MySignInController(
ConnectionFactoryLocator connectionFactoryLocator,
UsersConnectionRepository usersConnectionRepository,
SignInAdapter signInAdapter) {
super(connectionFactoryLocator, usersConnectionRepository, signInAdapter);
googleParams.add("access_type", "offline");
googleParams.add("approval_prompt", "force");
this.connectionFactoryLocator = connectionFactoryLocator;
}
@RequestMapping(value="/ext/google", method=RequestMethod.POST)
public RedirectView googleSignIn(@PathVariable String providerId, NativeWebRequest request) {
ConnectionFactory<?> connectionFactory = connectionFactoryLocator.getConnectionFactory(prov iderId);
try {
return new RedirectView(webSupport.buildOAuthUrl(connectionFa ctory, request, googleParams));
} catch (Exception e) {
return new RedirectView(URIBuilder.fromUri("/social/signin/").queryParam("error", "provider").build().toString(),true);
}
}
dispatcher-servlet.xml
<context:component-scan
base-package="nl.project.webapp">
<!-- exclude controllers that are picked up by Spring Social -->
<context:exclude-filter type="annotation" expression="nl.project.webapp.social.MySignInContr oller"/>
</context:component-scan>
I hadn't replied to your original message because I was looking into making ProviderSignInController more flexible in this regard. But as you've discovered, a more immediate option (while I sort out what to do with PSIC) is to create your own sign in controller.
As for the exclusion problem: You've got an annotation type exclude filter, but your expression refers to MySignInController. That would only work if MySignInController were an annotation and your controller (with a different name) were annotated with it. You'll want to use one of the other filter types, such as assignable (or aspectj or regex) to exclude the controller.
BTW, since this problem is only tangentially related to Spring Social Google, perhaps it's time to start a new thread?
Craig Walls
Spring Social Project Lead
did the guznik github repo move? It's not available anymore
Hey All,
It looks like the latest version of spring-social-google removes a bunch of functionality like saving contacts and uploading contact photos. I see above that guznik is only working on this in his/her spare time. Does anyone know if these changes are pending soon or if I should consider implementing & submitting a push request?
Thanks!
Doug