Skip to content

Commit

Permalink
audible: remove cookie persistence
Browse files Browse the repository at this point in the history
Signed-off-by: Jesse Stuart <email@jessestuart.ca>
  • Loading branch information
jvatic committed Jan 29, 2021
1 parent 61a0873 commit 7c5a95d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 134 deletions.
6 changes: 3 additions & 3 deletions audible/audible.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package audible
import (
"fmt"
"net/http"
"net/http/cookiejar"
"net/url"

"github.com/jvatic/audible-downloader/internal/cookiejar"
log "github.com/sirupsen/logrus"
"golang.org/x/net/publicsuffix"
)

type Option func(*Client)
Expand Down Expand Up @@ -74,8 +75,7 @@ func NewClient(opts ...Option) (*Client, error) {
baseLicenseURL: "https://www.audible.com",
}

// persistent cookiejar that wraps net/http/cookiejar.Jar
jar, err := cookiejar.NewJar()
jar, err := cookiejar.New(&cookiejar.Options{PublicSuffixList: publicsuffix.List})
if err != nil {
return nil, err
}
Expand Down
21 changes: 1 addition & 20 deletions audible/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,8 @@ func (c *Client) Authenticate(ctx context.Context) error {

s := &authState{c: c}

// check if we're already authenticated via a cookie
steps := []authStep{
s.getLandingPage,
s.overrideIPRedirect,
s.confirmAuth,
}

var err error
for _, step := range steps {
if err = step(ctx); err != nil {
break
}
}

if err == nil {
// we're authenticated
return nil
}

// we're not authenticated, so run through the full signin process
steps = []authStep{
steps := []authStep{
s.getLandingPage,
s.overrideIPRedirect,
s.getSigninPage,
Expand Down
111 changes: 0 additions & 111 deletions internal/cookiejar/cookiejar.go

This file was deleted.

0 comments on commit 7c5a95d

Please sign in to comment.