@@ -15,11 +15,14 @@ import (
15
15
16
16
func newConf (serverURL string ) * Config {
17
17
return & Config {
18
- ClientID : "CLIENT_ID" ,
19
- ClientSecret : "CLIENT_SECRET" ,
20
- Scopes : []string {"scope1" , "scope2" },
21
- TokenURL : serverURL + "/token" ,
22
- EndpointParams : url.Values {"audience" : {"audience1" }},
18
+ ClientID : "CLIENT_ID" ,
19
+ ClientSecret : "CLIENT_SECRET" ,
20
+ Scopes : []string {"scope1" , "scope2" },
21
+ TokenURL : serverURL + "/token" ,
22
+ EndpointParams : url.Values {
23
+ "audience" : {"audience1" },
24
+ "grant_type" : {"password" },
25
+ },
23
26
}
24
27
}
25
28
@@ -50,8 +53,8 @@ func TestTokenRequest(t *testing.T) {
50
53
if err != nil {
51
54
t .Errorf ("failed reading request body: %s." , err )
52
55
}
53
- if string ( body ) ! = "audience=audience1&grant_type=client_credentials &scope=scope1+scope2" {
54
- t .Errorf ("payload = %q; want %q" , string (body ), "grant_type=client_credentials&scope=scope1+scope2" )
56
+ if wantBody : = "audience=audience1&grant_type=password &scope=scope1+scope2" ; string ( body ) != wantBody {
57
+ t .Errorf ("payload = %q; want %q" , string (body ), wantBody )
55
58
}
56
59
w .Header ().Set ("Content-Type" , "application/x-www-form-urlencoded" )
57
60
w .Write ([]byte ("access_token=90d64460d14870c08c81352a05dedd3465940a7c&token_type=bearer" ))
@@ -86,7 +89,7 @@ func TestTokenRefreshRequest(t *testing.T) {
86
89
t .Errorf ("Unexpected Content-Type header, %v is found." , headerContentType )
87
90
}
88
91
body , _ := ioutil .ReadAll (r .Body )
89
- if string (body ) != "audience=audience1&grant_type=client_credentials &scope=scope1+scope2" {
92
+ if string (body ) != "audience=audience1&grant_type=password &scope=scope1+scope2" {
90
93
t .Errorf ("Unexpected refresh token payload, %v is found." , string (body ))
91
94
}
92
95
}))
0 commit comments