paypal/identity.go

25 lines
569 B
Go
Raw Normal View History

2019-08-21 15:50:20 +02:00
package paypal
2016-01-18 09:42:42 +01:00
import (
2021-01-03 10:28:52 +01:00
"context"
"fmt"
"net/http"
)
2016-01-18 09:42:42 +01:00
// GetUserInfo - Use this call to retrieve user profile attributes.
// Endpoint: GET /v1/identity/openidconnect/userinfo/?schema=<Schema>
2021-01-03 10:28:52 +01:00
func (c *Client) GetUserInfo(ctx context.Context, schema string) (*UserInfo, error) {
2019-06-16 04:39:08 +02:00
u := &UserInfo{}
2021-01-03 10:28:52 +01:00
req, err := http.NewRequestWithContext(ctx, "GET", fmt.Sprintf("%s%s%s", c.APIBase, "/v1/identity/openidconnect/userinfo/?schema=", schema), nil)
if err != nil {
2019-06-16 04:39:08 +02:00
return u, err
}
2019-06-16 04:39:08 +02:00
if err = c.SendWithAuth(req, u); err != nil {
return u, err
}
2019-06-16 04:39:08 +02:00
return u, nil
}