2019-08-21 15:50:20 +02:00
|
|
|
package paypal
|
2016-01-18 09:42:42 +01:00
|
|
|
|
2016-01-20 05:17:19 +01:00
|
|
|
import (
|
2021-01-03 10:28:52 +01:00
|
|
|
"context"
|
2016-01-20 05:17:19 +01:00
|
|
|
"fmt"
|
|
|
|
"net/http"
|
|
|
|
)
|
2016-01-18 09:42:42 +01:00
|
|
|
|
2016-01-20 05:17:19 +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{}
|
2016-01-20 05:17:19 +01:00
|
|
|
|
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)
|
2016-01-20 05:17:19 +01:00
|
|
|
if err != nil {
|
2019-06-16 04:39:08 +02:00
|
|
|
return u, err
|
2016-01-20 05:17:19 +01:00
|
|
|
}
|
|
|
|
|
2019-06-16 04:39:08 +02:00
|
|
|
if err = c.SendWithAuth(req, u); err != nil {
|
|
|
|
return u, err
|
2016-01-20 05:17:19 +01:00
|
|
|
}
|
|
|
|
|
2019-06-16 04:39:08 +02:00
|
|
|
return u, nil
|
2016-01-20 05:17:19 +01:00
|
|
|
}
|