【发布时间】:2012-01-16 23:38:02
【问题描述】:
我尝试发布几个范围值以允许我的应用程序用于某些 google 服务...
我尝试了两个输入字段
<input type="hidden" name="scope" value="https://www.googleapis.com/auth/calendar" />
<input type="hidden" name="scope" value="https://www.googleapis.com/auth/userinfo.email" />
并且有一个带有 + 分隔符的输入字段
<input type="hidden" name="scope" value="https://www.googleapis.com/auth/calendar+https://www.googleapis.com/auth/userinfo.email" />
当我发送只有一个范围的表单时,它可以工作。 否则,使用 seeval 范围值 google 会使用此错误描述重定向我:
http://localhost:49972/redirect.aspx#error=invalid_request&error_description=OAuth+2+parameters+can+only+have+a+single+value:+scope&error_uri=http://code.google.com/apis/accounts/docs/OAuth2.html
在带有 oAuth2 的 google getting started 中,它适用于两个范围值。
这是我的代码:
<form id="form1" method="post" action="https://accounts.google.com/o/oauth2/auth?" >
<div>
<input type="hidden" name="response_type" value="code" />
<input type="hidden" name="client_id" value="my client id" />
<input type="hidden" name="redirect_uri" value="http://localhost:49972/redirect.aspx" />
<input type="hidden" name="scope" value="https://www.googleapis.com/auth/calendar" />
<input type="hidden" name="scope" value="https://www.googleapis.com/auth/userinfo.email" />
<input type="hidden" name="state" value="/profile" />
<input type="submit" value="go" />
</div>
</form>
【问题讨论】:
标签: oauth google-api oauth-2.0