You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi there. We found the need to invoke google people api ( https://developers.google.com/people/ ) as we want to retrieve information from users when logging in our app, even if they don't have a google plus profile.
In order to achieve that we needed use google api client, as with the rest operations (restTemplate) provided by spring social the mapping from the json received from the api to com.google.api.services.people.v1.model.Person was not done correctly, while the client was doing the mapping smoothly.
We would like to contribute adding a PeopleOperations invoking the people api and retrieving google account info, but that would actually break the pattern that spring social follows, as we wouldn't use restTemplate for that.
Our code looks like following:
`@Component
public class GooglePeopleClient {
private HttpTransport httpTransport;
private JacksonFactory jsonFactory;
@Autowired
public GooglePeopleClient(HttpTransport httpTransport,
JacksonFactory jsonFactory) {
this.httpTransport = httpTransport;
this.jsonFactory = jsonFactory;
}
public Person person(String token) {
GoogleCredential credential = new GoogleCredential.Builder().build().setAccessToken(token);
PeopleService peopleService =
new PeopleService.Builder(httpTransport, jsonFactory, credential).build();
try {
return peopleService.people().get("people/me")
.setPersonFields("birthdays,genders,names,photos,emailAddresses,phoneNumbers")
.execute();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}`
but we would like to wrap this in a peopleOperations so this is hidden behind spring social for a more consistent approach.
Before we start forking, and doing something with spring social I would like to get some feedback from you guys and see what you think about the approach.
The text was updated successfully, but these errors were encountered:
Hi @GabiAxel . After seeing some of the comments in other issues we realized that you guys didn't want to add a new api binding.
I have created a PR with the changes I have done in order to invoke people api using rest template, following the existing pattern.
Please let me know your thoughts / review it. For the moment we have just added the fields we needed in our development.
Thanks
Hi there. We found the need to invoke google people api ( https://developers.google.com/people/ ) as we want to retrieve information from users when logging in our app, even if they don't have a google plus profile.
In order to achieve that we needed use google api client, as with the rest operations (restTemplate) provided by spring social the mapping from the json received from the api to com.google.api.services.people.v1.model.Person was not done correctly, while the client was doing the mapping smoothly.
We would like to contribute adding a PeopleOperations invoking the people api and retrieving google account info, but that would actually break the pattern that spring social follows, as we wouldn't use restTemplate for that.
Our code looks like following:
`@Component
public class GooglePeopleClient {
}`
but we would like to wrap this in a peopleOperations so this is hidden behind spring social for a more consistent approach.
Before we start forking, and doing something with spring social I would like to get some feedback from you guys and see what you think about the approach.
The text was updated successfully, but these errors were encountered: