Documentation
¶
Index ¶
- func CallBackFromOAuth(w http.ResponseWriter, r *http.Request)
- func CallDiscoveryAPI()
- func ConnectToQuickbooks(w http.ResponseWriter, r *http.Request)
- func GenerateCSRF() string
- func GetAppNow(w http.ResponseWriter, r *http.Request)
- func GetCompanyInfo(w http.ResponseWriter, r *http.Request)
- func PrepareUrl(scope string, csrf string) string
- func RefreshToken(w http.ResponseWriter, r *http.Request)
- func RevokeToken(w http.ResponseWriter, r *http.Request)
- func SignInWithIntuit(w http.ResponseWriter, r *http.Request)
- func ValidateIDToken(idToken string) bool
- type Address
- type BearerTokenResponse
- type Claims
- type DiscoveryAPIResponse
- type Header
- type JWKSResponse
- type Keys
- type UserInfoResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CallBackFromOAuth ¶
func CallBackFromOAuth(w http.ResponseWriter, r *http.Request)
* This is the redirect handler you configure in your app on developer.intuit.com * The Authorization code has a short lifetime. * Hence unless a user action is quick and mandatory, proceed to exchange the Authorization Code for * BearerToken
func ConnectToQuickbooks ¶
func ConnectToQuickbooks(w http.ResponseWriter, r *http.Request)
* Handler for connectToQuickbooks button
func GetAppNow ¶
func GetAppNow(w http.ResponseWriter, r *http.Request)
* Handler for getAppNow button
func GetCompanyInfo ¶
func GetCompanyInfo(w http.ResponseWriter, r *http.Request)
* Sample QBO API call to get CompanyInfo using OAuth2 tokens
func PrepareUrl ¶
* Prepares URL to call the OAuth2 authorization endpoint using Scope, CSRF and redirectURL that is supplied
func RefreshToken ¶
func RefreshToken(w http.ResponseWriter, r *http.Request)
* Call the refresh endpoint to generate new tokens
func RevokeToken ¶
func RevokeToken(w http.ResponseWriter, r *http.Request)
* Call the revoke endpoint to revoke tokens
func SignInWithIntuit ¶
func SignInWithIntuit(w http.ResponseWriter, r *http.Request)
* Handler for signInWithIntuit button
Types ¶
type BearerTokenResponse ¶
type BearerTokenResponse struct { RefreshToken string `json:"refresh_token"` AccessToken string `json:"access_token"` TokenType string `json:"token_type"` IdToken string `json:"id_token"` ExpiresIn int64 `json:"expires_in"` XRefreshTokenExpiresIn int64 `json:"x_refresh_token_expires_in"` }
func RetrieveBearerToken ¶
func RetrieveBearerToken(code string) (*BearerTokenResponse, error)
* Method to retrive access token (bearer token)
type DiscoveryAPIResponse ¶
type DiscoveryAPIResponse struct { Issuer string `json:"issuer"` AuthorizationEndpoint string `json:"authorization_endpoint"` TokenEndpoint string `json:"token_endpoint"` UserinfoEndpoint string `json:"userinfo_endpoint"` RevocationEndpoint string `json:"revocation_endpoint"` JwksUri string `json:"jwks_uri"` }
type JWKSResponse ¶
type JWKSResponse struct {
KEYS []Keys `json:"keys"`
}
func CallJWKSAPI ¶
func CallJWKSAPI() (*JWKSResponse, error)
* Call JWKS endpoint and retrieve the key values
type UserInfoResponse ¶
type UserInfoResponse struct { Sub string `json:"sub"` Email string `json:"email"` EmailVerified bool `json:"emailVerified"` GivenName string `json:"givenName"` FamilyName string `json:"familyName"` PhoneNumber string `json:"phoneNumber"` PhoneNumberVerified bool `json:"phoneNumberVerified"` Address Address `json:"address"` }
func GetUserInfo ¶
func GetUserInfo(w http.ResponseWriter, r *http.Request, accessToken string) (*UserInfoResponse, error)
* Method to retrive userInfo - email, address, name, phone etc