41
我嘗試發佈sereval範圍值,讓我的一些谷歌應用服務...多的範圍值到OAuth2
我想有兩個輸入字段
<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" />
當我發送我的表單只有一個範圍它的工作。 否則與sereval範圍值谷歌重定向我這個錯誤描述:
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
在谷歌getting started用的oauth2它的工作原理有兩個範圍值。
這裏是我的代碼:
<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>
我沒有我的代碼,直到tomorow但謝謝你埃文如果它似乎不可思議 –
目前在2017年,你應該使用'值=「https://www.googleapis.com/auth/calendar電子郵件」' – user3479125
爲了好奇,[RFC 6749,3.3節](https://tools.ietf.org/html/rfc6749#section-3.3)將'scope'參數定義爲'scope參數的值表示爲一個列表空格分隔的,區分大小寫的字符串。 – davidjb