diff --git a/server/server.go b/server/server.go index 396764c..fc21aca 100644 --- a/server/server.go +++ b/server/server.go @@ -25,7 +25,7 @@ const ( // UserCredential holds the username and password that the API should use to // authenticate to the REST API type UserCredential struct { - Domain, Username, Password string + Domain, Username, Password, Token string } // Configuration settings for the API @@ -255,6 +255,9 @@ func (s Server) uploadFile(secretId int, fileField SecretField) error { // getAccessToken gets an OAuth2 Access Grant and returns the token // endpoint and get an accessGrant. func (s *Server) getAccessToken() (string, error) { + if s.Credentials.Token != "" { + return s.Credentials.Token, nil + } response, err := s.checkPlatformDetails() if err != nil { log.Print("Error while checking server details:", err)