-4

I'm trying to make a website and I need to have a code in my server side (JAVA) or even in front (Javascript) so that when user enters someone's gmail, it automatically gets first and last name associated with that gmail and puts it in database. How is that possible to get full name from only gmail (if it exists) ?

GeorgeTheGood
  • 65
  • 2
  • 13
  • https://stackoverflow.com/questions/2108537/which-google-api-to-use-for-getting-users-first-name-last-name-picture-etc – Darshan Mehta Jun 24 '17 at 09:25
  • @DarshanMehta look, it by itself redirects to https://stackoverflow.com/questions/7130648/get-user-info-via-google-api which says that it needs authorization. I want it to make without authorization of someone. I want to make it so that when i write someones gmail it automatically gets the name and last name of that gmail account. – GeorgeTheGood Jun 24 '17 at 12:35

1 Answers1

0

No, that is not possible without authorization. You either have to authenticate yourself or let the user perform the authentication at client side and use Google's user API with the token.

Imagine Google giving your personal details to anyone just because he/she knows your email id, why'd they ever do that?

Darshan Mehta
  • 30,102
  • 11
  • 68
  • 102
  • 1
    No I don't want personal details, I just want first and last name and an image url. Google actually gives it because if you type someones email during sending message it automatically tells you first and last name. (for instance if i write example@example.com when i want to send a message it automatically gives me example's first and last name) So why shouldn't it be possible with code? – GeorgeTheGood Jun 24 '17 at 12:47
  • Because when you type someone's email address, you are already *logged in* and hence, it returns you the info. – Darshan Mehta Jun 24 '17 at 12:49
  • Yes but I am logged in as my own account, And it gives me info of somebody else's account. Just exactly Want i want using code. – GeorgeTheGood Jun 24 '17 at 12:51
  • So, you first need to log in using your own account and use the API to get the results. – Darshan Mehta Jun 24 '17 at 12:52
  • Oh alright, Logging in with my account wouldn't be any problem. So If i guarantee that I am logged in as my account, then how can I scrap someone else's first and last name ? – GeorgeTheGood Jun 24 '17 at 12:53
  • Try [this](https://developers.google.com/admin-sdk/directory/v1/reference/users/get) API? – Darshan Mehta Jun 24 '17 at 13:12