Skip to content

Commit

Permalink
Adapt authentication to new auth style
Browse files Browse the repository at this point in the history
* See #1
  • Loading branch information
riton committed Jan 3, 2022
1 parent 42a76c9 commit c282241
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.pdf
ensap-payroll-cli
ensap
ensap-cli
/dist
7 changes: 7 additions & 0 deletions api/v1/authentication.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,20 @@ func (c *ensapV1APIClient) Login() error {

endpoint := c.buildFullEndpoint(api.AuthentificationEndpoint, false)

log.Debugf("logging in using endpoint %s", endpoint)

req, err := http.NewRequestWithContext(c.ctx, http.MethodPost, endpoint, strings.NewReader(formData.Encode()))
if err != nil {
return errors.Wrap(err, "creating request object")
}
c.setRequestUserAgent(req)

req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
req.Header.Set("Accept", "application/json")

// if c.cfg.Debug {
// debugDumpHTTPRequest("Login", req, true)
// }

resp, err := c.httpClient.Do(req)
if err != nil {
Expand Down

0 comments on commit c282241

Please sign in to comment.