为什么我的 Google OAuth URL 在返回的 URL 中放置了哈希值?

cer*_*eny 2 php google-app-engine

给定的网址:

https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth% 2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive&state=drive&redirect_uri=http%3A%2F%2Fwww.woktop.com%2Fnewservice.php&response_type=token&client_id=889314330670.apps.googleusercontent.com

返回网址:

http://www.woktop.com/newservice.php#state=drive&access_token=ya29.AHES6ZRtTRmpakw5qa0SejLsC0qzNNb9R6GYF0xZGt_uphe3WfeeZng&token_type=Bearer&expires_in=3600

#如果将 更改为 a ?(以启动查询字符串),则返回 URL 完全有效。为什么谷歌会返回 a#从而“杀死查询字符串”

单独说明:

另外,我不太知道我是否应该请求tokencode作为响应类型。我计划让用户将他们的 Google 云端硬盘帐户附加到我网站上的帐户。我已多次阅读该文档,但无法完全弄清楚哪一个更适合我的网站?现在(在上面的示例中)我使用令牌。另外,根据我使用哪一个,我应该在数据库中存储什么以供将来使用?

cer*_*eny 5

原因是因为我请求的是 atoken而不是code. 当我收到代码时,URL 的格式没有哈希值 ( #),而是格式化为查询字符串。我不清楚其原因,但文档指出它token只能用作重型 Javascript 应用程序的响应类型。我编写的 API 代码是用 PHP 编写的,因此code显然是合适的选择。