Documentation
¶
Overview ¶
Package session provides handles creation of a Salesforce session. Device authorization follows the OAuth 2.0 Device Authentication flow as outlined at https://help.salesforce.com/articleView?id=remoteaccess_oauth_device_flow.htm&type=5
Package session provides handles creation of a Salesforce session
Index ¶
- Constants
- type Clienter
- type InstanceFormatter
- type ServiceFormatter
- type Session
- func (session *Session) AccessToken() string
- func (session *Session) AuthorizationHeader(request *http.Request)
- func (session *Session) Client() *http.Client
- func (session *Session) ID() string
- func (session *Session) InstanceURL() string
- func (session *Session) IssuedAt() string
- func (session *Session) RefreshToken() string
- func (session *Session) ServiceURL() string
- func (session *Session) Signature() string
- func (session *Session) TokenType() string
Constants ¶
const ( AccessDeniedErrorCode = "access_denied" AuthorizationPendingErrorCode = "authorization_pending" InvalidGrantErrorCode = "invalid_grant" InvalidRequestErrorCode = "invalid_request" ServerErrorErrorCode = "server_error" SlowDownErrorCode = "slow_down" )
TODO(@rmulley): Add comments to each error.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InstanceFormatter ¶
type InstanceFormatter interface { InstanceURL() string AuthorizationHeader(*http.Request) Clienter }
InstanceFormatter is the session interface that formaters the session instance information used by the resources.
InstanceURL will return the Salesforce instance.
AuthorizationHeader will add the authorization to the HTTP request's header.
type ServiceFormatter ¶
type ServiceFormatter interface { InstanceFormatter ServiceURL() string }
ServiceFormatter is the session interface that formats the session for service resources.
ServiceURL provides the service URL for resources to user.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session is the authentication response. This is used to generate the authroization header for the Salesforce API calls.
func Open ¶
Open is used to authenticate with Salesforce and open a session. The user will need to supply the proper credentials and a HTTP client.
func (*Session) AccessToken ¶
func (*Session) AuthorizationHeader ¶
AuthorizationHeader will add the authorization to the HTTP request's header.
func (*Session) InstanceURL ¶
InstanceURL will retuern the Salesforce instance from the session authentication.
func (*Session) RefreshToken ¶
func (*Session) ServiceURL ¶
ServiceURL will return the Salesforce instance for the service URL.