forked from go-packages/paypal
webapps URL
This commit is contained in:
parent
3d924aeaf4
commit
2f016eafbb
2
auth.go
2
auth.go
|
@ -20,7 +20,7 @@ func (c *Client) GetAuthorizationCodeURL(redirectURI string, scopes []string) (s
|
|||
scopes = []string{"profile", "email"}
|
||||
}
|
||||
|
||||
return c.APIBase + "/webapps/auth/protocol/openidconnect/v1/authorize?client_id=" +
|
||||
return strings.Replace(c.APIBase, "api.", "", -1) + "/webapps/auth/protocol/openidconnect/v1/authorize?client_id=" +
|
||||
url.QueryEscape(c.ClientID) + "&response_type=code&scope=" + strings.Join(scopes, "+") +
|
||||
"&redirect_uri=" + url.QueryEscape(redirectURI), nil
|
||||
}
|
||||
|
|
|
@ -13,13 +13,13 @@ func TestGetAuthorizationCodeURL(t *testing.T) {
|
|||
}
|
||||
|
||||
uri, err := c.GetAuthorizationCodeURL("test", []string{})
|
||||
if uri != "https://api.sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize?client_id=clid&response_type=code&scope=profile+email&redirect_uri=test" {
|
||||
t.Errorf("GetAuthorizationCodeURL returns incorrect value for redirectURI=test")
|
||||
if uri != "https://sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize?client_id=clid&response_type=code&scope=profile+email&redirect_uri=test" {
|
||||
t.Errorf("GetAuthorizationCodeURL returns incorrect value for redirectURI=test " + uri)
|
||||
}
|
||||
|
||||
uri, err = c.GetAuthorizationCodeURL("test", []string{"address"})
|
||||
if uri != "https://api.sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize?client_id=clid&response_type=code&scope=address&redirect_uri=test" {
|
||||
t.Errorf("GetAuthorizationCodeURL returns incorrect value for redirectURI=test and scope=address")
|
||||
if uri != "https://sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize?client_id=clid&response_type=code&scope=address&redirect_uri=test" {
|
||||
t.Errorf("GetAuthorizationCodeURL returns incorrect value for redirectURI=test and scope=address " + uri)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user