facebook

package
v1.1.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExchangeToken

func ExchangeToken(appID, appSecret, shortToken string) (string, error)

ExchangeToken exchanges short living token to long living token. See https://developers.facebook.com/docs/facebook-login/access-tokens/refreshing.

Types

type Client

type Client struct {
	AccessToken string
	BaseURL     *url.URL
	HTTPClient  *http.Client
}

Client is a Facebook SDK client for making GraphAPI requests and handling errors.

func NewClient

func NewClient(accessToken string) *Client

NewClient creates new http client with short lived access token.

func (*Client) MyProfile

func (c *Client) MyProfile() (User, error)

MyProfile asks for token's owner public profile information: id and name. More functions can be implemented later.

type Token

type Token struct {
}

Token represents token model for token refresh and token exchange

type User

type User struct {
	ID         string `json:"id,omitempty"` // ID of this person's user account. This ID is unique to each app and cannot be used across different apps.
	Email      string `json:"email,omitempty"`
	Name       string `json:"name,omitempty"`
	ProfilePic string `json:"profile_pic,omitempty"`
}

User is a user profile data on Facebook platform: https://developers.facebook.com/docs/graph-api/reference/v2.6/user.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL