问题
I am developing a custom WordPress plugin to retrieve the page views and URL of posts. According to gaDataAuthorization, Plugin is an installed application.
And ouath2InstalledApp. Here I read it is same as Using OAuth 2.0 for Web Server Applications, having three differences.
But when I am trying to use urn:ietf:wg:oauth:2.0:oob
as the redirect URI, it is not working. Can anybody give me any idea?
In the developer console it alerts:
Must have a protocol. Cannot contain URL fragments or relative paths. Cannot be a public IP address. '
redirect_uri
| One of the redirect_uri values obtained from the Google Developers Console. | Determines where the response is sent. The value of this parameter must exactly match one of the values that appear in the Credentials page in the Google Developers Console (including the http or https scheme, case, and trailing slash). You may choose between urn:ietf:wg:oauth:2.0:oob, urn:ietf:wg:oauth:2.0:oob:auto, or an http://localhost port. For more details, see Choosing a redirect URI.
回答1:
The picture below shows where you need to choose "other". The Hello analytics app does not specify it.
That will create your installedApp (the WordPress plugin is treated as installedApp). Now you do not need to specify redirect URI on your console.
Another question of mine will guide you better on your further steps. It is How to use refresh token to get authorized in background.
回答2:
It seems Google allows you to use any URI as a redirect URI. On the other hand, it seems other software libraries you are using accept only http://
or https://
.
来源:https://stackoverflow.com/questions/33676432/not-getting-correct-redirect-uri-for-google-analytics-installedapp-custom-plugi