Skip to content

Commit

Permalink
Merge pull request #18 from dnascimento/token
Browse files Browse the repository at this point in the history
Add support for Token authentication
  • Loading branch information
tylerezimmerman authored Apr 11, 2024
2 parents 3dae291 + 0e63ebd commit 571e567
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 571e567

Please sign in to comment.