Documentation ¶
Index ¶
- Variables
- type AccessTokenSchema
- type Facebook
- func (fb *Facebook) GenerateAccessToken(uri string) (*AccessTokenSchema, error)
- func (fb *Facebook) GenerateGetAccessTokenURI(code string) string
- func (fb *Facebook) GenerateGetProfileURI(accessToken string) string
- func (fb *Facebook) GenerateOauthURI() string
- func (fb *Facebook) Get() string
- func (fb *Facebook) GetProfile(uri string) (*map[string]interface{}, error)
- type Google
- func (g *Google) GenerateAccessToken(uri string) (*AccessTokenSchema, error)
- func (g *Google) GenerateGetAccessTokenURI(code string) string
- func (g *Google) GenerateGetProfileURI(accessToken string) string
- func (g *Google) GenerateOauthURI() string
- func (g *Google) Get() string
- func (g *Google) GetProfile(uri string) (*map[string]interface{}, error)
- type IProvider
Constants ¶
This section is empty.
Variables ¶
var ( // FACEBOOK service provider FACEBOOK = "FACEBOOK" // GOOGLE service provider GOOGLE = "GOOGLE" )
Functions ¶
This section is empty.
Types ¶
type AccessTokenSchema ¶
type AccessTokenSchema struct { AccessToken string `json:"access_token"` TokenType string `json:"token_type"` Scope string `json:"scope"` ExpiresIn int32 `json:"expires_in"` }
AccessTokenSchema is a schema for parsing token object from the service provider
type Facebook ¶
type Facebook struct { ServiceProvider string GraphURL string OauthURL string ClientID string ClientSecret string OauthRedirectURI string OauthScope string Fields string }
Facebook represents the Facebook service provider
func (*Facebook) GenerateAccessToken ¶
func (fb *Facebook) GenerateAccessToken(uri string) (*AccessTokenSchema, error)
GenerateAccessToken generates a Facebook access token
func (*Facebook) GenerateGetAccessTokenURI ¶
GenerateGetAccessTokenURI returns an oauth URI to generate access token from Facebook
func (*Facebook) GenerateGetProfileURI ¶
GenerateGetProfileURI returns a URI to get Facebook profile
func (*Facebook) GenerateOauthURI ¶
GenerateOauthURI returns an oauth URI that will be use by the M9 to redirect to Facebook to the generate the code
type Google ¶
type Google struct { ServiceProvider string APIURL string OauthURL string OauthTokenURL string ClientID string ClientSecret string OauthRedirectURI string OauthScope string }
Google represents the Google service provider
func (*Google) GenerateAccessToken ¶
func (g *Google) GenerateAccessToken(uri string) (*AccessTokenSchema, error)
GenerateAccessToken generates a Google access token
func (*Google) GenerateGetAccessTokenURI ¶
GenerateGetAccessTokenURI returns an oauth URI to generate access token from Google
func (*Google) GenerateGetProfileURI ¶
GenerateGetProfileURI returns a URI to get Google profile
func (*Google) GenerateOauthURI ¶
GenerateOauthURI returns an oauth URI that will be use by the M9 to redirect to Google to the generate the code
type IProvider ¶
type IProvider interface { Get() string GenerateOauthURI() string GenerateGetAccessTokenURI(code string) string GenerateGetProfileURI(accessToken string) string GenerateAccessToken(uri string) (*AccessTokenSchema, error) GetProfile(uri string) (*map[string]interface{}, error) }
IProvider is an interface that should be implemented when creating a service provider object