social

package
v3.21.1 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppleProfile

type AppleProfile struct {
	ID            string
	Email         string
	EmailVerified bool
}

AppleProfile is an abbreviated version of a user authenticated through Apple Sign In.

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is responsible for making calls to different providers

func NewClient

func NewClient(logger *zap.Logger, timeout time.Duration, googleCnf *oauth2.Config) *Client

NewClient creates a new Social Client

func (*Client) CheckAppleToken

func (c *Client) CheckAppleToken(ctx context.Context, bundleId string, idToken string) (*AppleProfile, error)

func (*Client) CheckFacebookLimitedLoginToken added in v3.2.0

func (c *Client) CheckFacebookLimitedLoginToken(ctx context.Context, appId string, idToken string) (*FacebookProfile, error)

func (*Client) CheckGameCenterID

func (c *Client) CheckGameCenterID(ctx context.Context, playerID string, bundleID string, timestamp int64, salt string, signature string, publicKeyURL string) (bool, error)

CheckGameCenterID checks to see validity of the GameCenter playerID

func (*Client) CheckGoogleToken

func (c *Client) CheckGoogleToken(ctx context.Context, idToken string) (GoogleProfile, error)

CheckGoogleToken extracts the user's Google Profile from a given ID token.

func (*Client) ExtractFacebookInstantGameID

func (c *Client) ExtractFacebookInstantGameID(signedPlayerInfo string, appSecret string) (facebookInstantGameID string, err error)

Extract player ID and validate the Facebook Instant Game token.

func (*Client) GetFacebookFriends

func (c *Client) GetFacebookFriends(ctx context.Context, accessToken string) ([]FacebookProfile, error)

GetFacebookFriends queries the Facebook Graph. Token is expected to also have the "user_friends" permission.

func (*Client) GetFacebookProfile

func (c *Client) GetFacebookProfile(ctx context.Context, accessToken string) (*FacebookProfile, error)

GetFacebookProfile retrieves the user's Facebook Profile given the accessToken

func (*Client) GetSteamFriends added in v3.1.0

func (c *Client) GetSteamFriends(ctx context.Context, publisherKey, steamId string) ([]SteamProfile, error)

GetSteamFriends queries the Steam API for friends.

func (*Client) GetSteamProfile

func (c *Client) GetSteamProfile(ctx context.Context, publisherKey string, appID int, ticket string) (*SteamProfile, error)

GetSteamProfile retrieves the user's Steam Profile. Key and App ID should be configured at the application level. See: https://partner.steamgames.com/documentation/auth#client_to_backend_webapi

type FacebookPicture added in v3.6.0

type FacebookPicture struct {
	Height       int    `json:"height"`
	Width        int    `json:"width"`
	IsSilhouette bool   `json:"is_silhouette"`
	Url          string `json:"url"`
}

type FacebookPictureData added in v3.6.0

type FacebookPictureData struct {
	Data FacebookPicture `json:"data"`
}

type FacebookProfile

type FacebookProfile struct {
	ID      string              `json:"id"`
	Name    string              `json:"name"`
	Email   string              `json:"email"`
	Picture FacebookPictureData `json:"picture"`
}

FacebookProfile is an abbreviated version of a Facebook profile.

type GooglePlayServiceProfile added in v3.16.0

type GooglePlayServiceProfile struct {
	PlayerId         string `json:"playerId"`
	DisplayName      string `json:"displayName"`
	AvatarImageUrl   string `json:"avatarImageUrl"`
	OriginalPlayerId string `json:"originalPlayerId"`
}

GooglePlayServiceProfile is an abbreviated version of a Google profile using an access token.

func (*GooglePlayServiceProfile) GetAvatarImageUrl added in v3.16.0

func (p *GooglePlayServiceProfile) GetAvatarImageUrl() string

func (*GooglePlayServiceProfile) GetDisplayName added in v3.16.0

func (p *GooglePlayServiceProfile) GetDisplayName() string

func (*GooglePlayServiceProfile) GetEmail added in v3.16.0

func (p *GooglePlayServiceProfile) GetEmail() string

func (*GooglePlayServiceProfile) GetGoogleId added in v3.16.0

func (p *GooglePlayServiceProfile) GetGoogleId() string

func (*GooglePlayServiceProfile) GetOriginalGoogleId added in v3.17.0

func (p *GooglePlayServiceProfile) GetOriginalGoogleId() string

type GoogleProfile

type GoogleProfile interface {
	GetDisplayName() string
	GetEmail() string
	GetAvatarImageUrl() string
	GetGoogleId() string
	GetOriginalGoogleId() string
}

GoogleProfile is an abbreviated version of a Google profile extracted from a token.

type JWTGoogleProfile added in v3.16.0

type JWTGoogleProfile struct {
	// Fields available in all tokens.
	Iss string `json:"iss"`
	Sub string `json:"sub"`
	Azp string `json:"azp"`
	Aud string `json:"aud"`
	Iat int64  `json:"iat"`
	Exp int64  `json:"exp"`
	// Fields available only if the user granted the "profile" and "email" OAuth scopes.
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
	Name          string `json:"name"`
	Picture       string `json:"picture"`
	GivenName     string `json:"given_name"`
	FamilyName    string `json:"family_name"`
	Locale        string `json:"locale"`
}

JWTGoogleProfile is an abbreviated version of a Google profile extracted from a verified JWT token.

func (*JWTGoogleProfile) GetAvatarImageUrl added in v3.16.0

func (p *JWTGoogleProfile) GetAvatarImageUrl() string

func (*JWTGoogleProfile) GetDisplayName added in v3.16.0

func (p *JWTGoogleProfile) GetDisplayName() string

func (*JWTGoogleProfile) GetEmail added in v3.16.0

func (p *JWTGoogleProfile) GetEmail() string

func (*JWTGoogleProfile) GetGoogleId added in v3.16.0

func (p *JWTGoogleProfile) GetGoogleId() string

func (*JWTGoogleProfile) GetOriginalGoogleId added in v3.17.0

func (p *JWTGoogleProfile) GetOriginalGoogleId() string

type JwksCert added in v3.2.0

type JwksCert struct {
	Kty string `json:"kty"`
	Kid string `json:"kid"`
	Use string `json:"use"`
	Alg string `json:"alg"`
	N   string `json:"n"`
	E   string `json:"e"`
	// contains filtered or unexported fields
}

JWK certificate data for an Apple Sign In verification key.

type JwksCerts added in v3.2.0

type JwksCerts struct {
	Keys []*JwksCert `json:"keys"`
}

type SteamError

type SteamError struct {
	ErrorDesc string `json:"errordesc"`
	ErrorCode int    `json:"errorcode"`
}

SteamError contains a possible error response from the Steam Web API.

type SteamProfile

type SteamProfile struct {
	SteamID uint64 `json:"steamid,string"`
}

SteamProfile is an abbreviated version of a Steam profile.

type SteamProfileWrapper

type SteamProfileWrapper struct {
	Response struct {
		Params *SteamProfile `json:"params"`
		Error  *SteamError   `json:"error"`
	} `json:"response"`
}

Unwrapping the SteamProfile

Jump to

Keyboard shortcuts

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