Google analytics GoogleOAuth-2.0返回带有哈希而不是问号的url
我使用此表单请求Google离线令牌Google analytics GoogleOAuth-2.0返回带有哈希而不是问号的url,google-analytics,oauth-2.0,Google Analytics,Oauth 2.0,我使用此表单请求Google离线令牌 <form action="https://accounts.google.com/o/oauth2/auth" methode="POST"> <input type="hidden" name="access_type" value="offline" /> <input type="hidden" name="client_id" value="XXX" />
<form action="https://accounts.google.com/o/oauth2/auth" methode="POST">
<input type="hidden" name="access_type" value="offline" />
<input type="hidden" name="client_id" value="XXX" />
<input type="hidden" name="scope" value="https://www.googleapis.com/auth/analytics https://www.googleapis.com/auth/analytics.edit https://www.googleapis.com/auth/analytics.manage.users https://www.googleapis.com/auth/analytics.manage.users.readonly https://www.googleapis.com/auth/analytics.readonly" />
<input type="hidden" name="response_type" value="code token gsession" />
<input type="hidden" name="redirect_uri" value="http://example.com/analytics" />
<input type="hidden" name="approval_prompt" value="force" />
<button>Get or Refresh token</button>
</form>
请注意,我们在主url部分后面有一个哈希代码#
,而不是问号?
我本来希望用PHP$\u get
获得上述变量,但我不能,因为这是散列代码
我的问题是如何获得带有问号的url?您正在使用
代码令牌gsession
的响应类型,该类型触发所谓的隐式流,其中访问令牌将在url片段中返回。使用response\u type=code
获取一个code
值作为查询参数,您可以在令牌端点使用该值将其交换为access\u令牌
,如所述:这是授权码授予
的标准方式。对吗?response\u type=code
触发授权码授予类型indeed相当确定当我发送代码时收到错误=unsupported\u response\u type
http://example.com/analytics#access_token=XXX&token_type=Bearer&expires_in=3600&code=YYY&authuser=0&num_sessions=1&prompt=consent&session_state=ZZZ