I have user credentials of user gmail account, from that I have to retrieve access_token. How to do that? I've checked in google but couldn't find any solution.
my final objective: I'm trying to fetch the contact profile picture from gmail. I think that the image can be downloaded by requesting https://www.google.com/m8/feeds/photos/media/default/{contactId} but it requires the access token.
I have tried the example given in the google contacts documentation:
1st try
public static void DownloadPhoto(ContactsRequest cr, Uri contactURL)
{
Contact contact = cr.Retrieve<Contact>(contactURL);
Stream photoStream = cr.GetPhoto(contact);
FileStream outStream = File.OpenWrite("test.jpg");
byte[] buffer = new byte[photoStream.length];
photoStream.Read(buffer, 0, photoStream.length);
outStream.Write(buffer, 0, photoStream.length);
photoStream.Close();
outStream.Close();
}
in this am getting the photoStream object null
2nd try
Contact contact = ContactsRequest.get("https://www.google.com/m8/feeds/photos/media/default/<contactId>");
in this method am getting a parser error
Please suggest any links or example to retrieve photo from gmail contact or to get access token from user credentials. Thank you.