Google+ Moments.insert - Unauthorized Error

后端 未结 1 747
春和景丽
春和景丽 2021-01-28 18:34

According to the docuemtntation for Moments.insert with the Google+ API autentication with the following scope is required

https://www.googleapis.com/auth/plus.l         


        
相关标签:
1条回答
  • 2021-01-28 18:50

    As you've noticed, you need to add the request_visible_actions parameter to the request. Most of the other OAuth libraries from Google have added a shortcut to do this, but it looks like the .NET library hasn't. For example, the PHP library has setRequestVisibleActions().

    Internally, the convenience method GoogleWebAuthorizationBroker.AuthorizeAsync() calls AuthorizationCodeFlow.CreateAuthorizationCodeRequest() to generate the URL used in the call. You can subclass AuthorizationCodeFlow and AuthorizationCodeRequestUrl (which it returns) to add the parameter in question and then go through the flow more directly.

    You can see an example of how to do this at https://github.com/gguuss/google-dotnet-demo/blob/master/AuthWithAppActivities/Program.cs

    You can also use a Google+ Sign-In button to do the initial auth flow and pass the one-time code to the server, which can then proceed to turn this into a valid token. Since the Sign-In button has the data-requestvisibleactions attribute, this will take care of that part of the auth for you.

    0 讨论(0)
提交回复
热议问题