After struggling to authenticate on the Google+ API, I finally succeed to retrieve my info with https://www.googleapis.com/plus/v1/people/{MyUserId}?key={ApiKey}
However, despite I did obtain an access token with the scope https://www.googleapis.com/auth/plus.me I cannot request “me” : https://www.googleapis.com/plus/v1/people/me?key={ApiKey}
I end up with an 401 unauthorised request… It’s late and I don’t get what I’m missing.
Here is my code:
string apiUrl = "https://www.googleapis.com/plus/v1/people/me?key={my api key";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(apiUrl);
request.Method = HttpMethod.GET.ToString();
try
{
using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
=> 401 error
Thank you for your help!
This doesn’t directly answer your question, but have you tried the Google APIs Client Library for .NET?
See: http://code.google.com/p/google-api-dotnet-client/
http://code.google.com/p/google-api-dotnet-client/wiki/OAuth2
http://code.google.com/p/google-api-dotnet-client/wiki/APIs#Google+_API
The 401 error most likely means your access token has expired, and needs to be refreshed with the refresh token.