Add LoginOpenAccount

Close #101 again
This commit is contained in:
Alexander Sheiko 2023-05-30 17:31:00 +03:00
parent 16e8b34638
commit e52022e31a
10 changed files with 224 additions and 34 deletions

6
api.go
View file

@ -33,7 +33,11 @@ func (s *Scraper) RequestAPI(req *http.Request, target interface{}) error {
req.Header.Set("X-Guest-Token", s.guestToken)
}
req.Header.Set("Authorization", "Bearer "+s.bearerToken)
if s.oAuthToken != "" && s.oAuthSecret != "" {
req.Header.Set("Authorization", s.sign(req.Method, req.URL))
} else {
req.Header.Set("Authorization", "Bearer "+s.bearerToken)
}
for _, cookie := range s.client.Jar.Cookies(req.URL) {
if cookie.Name == "ct0" {