Documentation ¶
Overview ¶
Package legacy implements the deprecated legacy authentication methods for the version 2 Docusign rest api. Api documentation for these functions may be found at: https://docs.docusign.com/esign/guide/authentication/legacy_auth.html
Example (Config) ¶
package main import ( "context" "fmt" "log" "github.com/ICGGroup/esign/legacy" "github.com/ICGGroup/esign/v2/folders" ) func main() { cfg := legacy.Config{ AccountID: "c23357a7-4f00-47f5-8802-94d2b1fb9a29", IntegratorKey: "51d1a791-489c-4622-b743-19e0bd6f359e", UserName: "sample User", Password: "****************", Host: "na1.docusign.com", } sv := folders.New(cfg) fl, err := sv.List().Do(context.Background()) if err != nil { log.Fatalf("Folder list error: %v", err) } for _, fld := range fl.Folders { fmt.Printf("%s: %s", fld.Name, fld.FolderID) } }
Output:
Example (Oauth) ¶
package main import ( "context" "fmt" "log" "github.com/ICGGroup/esign/legacy" "github.com/ICGGroup/esign/v2/folders" ) func main() { cfg := legacy.Config{ AccountID: "c23357a7-4f00-47f5-8802-94d2b1fb9a29", IntegratorKey: "51d1a791-489c-4622-b743-19e0bd6f359e", UserName: "sample User", Password: "****************", Host: "na1.docusign.com", } cred, err := cfg.OauthCredential(context.Background()) if err != nil { log.Fatalf("oauth err: %v", err) } // save cred for future use sv := folders.New(cred) fl, err := sv.List().Do(context.Background()) if err != nil { log.Fatalf("Folder list error: %v", err) } for _, fld := range fl.Folders { fmt.Printf("%s: %s", fld.Name, fld.FolderID) } }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // The docusign account used by the login user. This may be // found using the LoginInformation call. AccountID string `json:"acctId,omitempty"` IntegratorKey string `json:"key"` UserName string `json:"user"` Password string `json:"pwd"` Host string `json:"host,omitempty"` // Deprecated - use Host IsDemoAccount bool `json:"isDemo,omitempty"` OnBehalfOf string `json:"onBehalfOf,omitempty"` ctxclient.Func }
Config provides methods to authenticate via a user/password combination. It may also be used to generate an OauthCredential. If Host is empty, the IsDemoAccount is used to determine the host.
Documentation: https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#SOBO/Send On Behalf Of Functionality in the DocuSign REST API.htm
func (Config) AuthDo ¶
func (c Config) AuthDo(ctx context.Context, req *http.Request, v *esign.APIVersion) (*http.Response, error)
AuthDo adds authorization headers, adds accountID to url and sends request
func (*Config) OauthCredential ¶
func (c *Config) OauthCredential(ctx context.Context) (*OauthCredential, error)
OauthCredential retrieves an OauthCredential from docusign using the username and password from Config. The returned token does not have a expiration although it may be revoked via OauthCredential.Revoke()
type OauthCredential ¶
type OauthCredential struct { // The docusign account used by the login user. This may be // found using the LoginInformation call. AccountID string `json:"account_id,omitempty"` AccessToken string `json:"access_token,omitempty"` Scope string `json:"scope,omitempty"` TokenType string `json:"token_type,omitempty"` Host string `json:"host,omitempty"` IsDemoAccount bool `json:"isDemo,omitempty"` OnBehalfOf string `json:"onBehalfOf,omitempty"` ctxclient.Func }
OauthCredential provides authorization for rest request via docusign's oauth protocol.
Documentation: https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#OAuth2/OAuth2 Authentication Support in DocuSign REST API.htm NOTE: Soon to be deprecated (https://www.docusign.com/p/RESTAPIGuide/RESTAPIGuide.htm#OAuth2/OAuth2 Token Request.htm) Use esign.Oauth2Credential in future.
func (OauthCredential) AuthDo ¶
func (o OauthCredential) AuthDo(ctx context.Context, req *http.Request, v *esign.APIVersion) (*http.Response, error)
AuthDo updates request with authorization headers, adds account to URL and sends request
func (*OauthCredential) OnBehalfOfCredential ¶
func (o *OauthCredential) OnBehalfOfCredential(ctx context.Context, integratorKey, nm string) (*OauthCredential, error)
OnBehalfOfCredential returns an *OauthCredential for the user name specied by nm. oauthCred must be a credential for a user with administrative rights on the account.