google: update ApprovalForce to use openid connect friendly prompt=consent

It looks like in 2016 or so` approval_prompt=force` was replaced with the open id connect friendly `prompt=consent`.

See:
- https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
- https://developers.google.com/identity/sign-in/web/reference#gapiauth2offlineaccessoptions
- https://github.com/googleapis/oauth2client/issues/453
- https://github.com/pomerium/pomerium/pull/82

Change-Id: Iad2d533f451a70b2941aafd11c9b7272026a2f16
GitHub-Last-Rev: d6d10ceec8
GitHub-Pull-Request: golang/oauth2#379
Reviewed-on: https://go-review.googlesource.com/c/oauth2/+/171123
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Bobby DeSimone 2019-04-09 03:31:09 +00:00 committed by Brad Fitzpatrick
parent 950ef44c6e
commit aaccbc9213
2 changed files with 2 additions and 2 deletions

View File

@ -117,7 +117,7 @@ var (
// ApprovalForce forces the users to view the consent dialog // ApprovalForce forces the users to view the consent dialog
// and confirm the permissions request at the URL returned // and confirm the permissions request at the URL returned
// from AuthCodeURL, even if they've already done so. // from AuthCodeURL, even if they've already done so.
ApprovalForce AuthCodeOption = SetAuthURLParam("approval_prompt", "force") ApprovalForce AuthCodeOption = SetAuthURLParam("prompt", "consent")
) )
// An AuthCodeOption is passed to Config.AuthCodeURL. // An AuthCodeOption is passed to Config.AuthCodeURL.

View File

@ -43,7 +43,7 @@ func newConf(url string) *Config {
func TestAuthCodeURL(t *testing.T) { func TestAuthCodeURL(t *testing.T) {
conf := newConf("server") conf := newConf("server")
url := conf.AuthCodeURL("foo", AccessTypeOffline, ApprovalForce) url := conf.AuthCodeURL("foo", AccessTypeOffline, ApprovalForce)
const want = "server/auth?access_type=offline&approval_prompt=force&client_id=CLIENT_ID&redirect_uri=REDIRECT_URL&response_type=code&scope=scope1+scope2&state=foo" const want = "server/auth?access_type=offline&client_id=CLIENT_ID&prompt=consent&redirect_uri=REDIRECT_URL&response_type=code&scope=scope1+scope2&state=foo"
if got := url; got != want { if got := url; got != want {
t.Errorf("got auth code URL = %q; want %q", got, want) t.Errorf("got auth code URL = %q; want %q", got, want)
} }