Skip to content

Commit

Permalink
Fail when auth can't be refreshed
Browse files Browse the repository at this point in the history
milesmcc committed Mar 13, 2024
1 parent db266a4 commit d09fdeb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/auth/auth.go
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@ package auth
import (
"context"
"fmt"
"os"
"time"

log "github.com/sirupsen/logrus"
@@ -83,7 +84,6 @@ func (a *Authenticator) Authenticate(identifier string, password string) (*xrpc.
Handle: output.Handle,
}

a.Client.Auth = &info
go a.refreshTokenContinuously(output)
return &info, nil
}
@@ -102,7 +102,8 @@ func (a *Authenticator) refreshTokenContinuously(authOutput *atproto.ServerCreat
_, error := atproto.ServerRefreshSession(a.Context, a.Client)

if error != nil {
log.Errorf("Error refreshing token: %+v", error)
log.Errorf("Error refreshing token: %+v; this is typically catastrophic, so shutting down", error)
os.Exit(1)
} else {
log.Debugf("Successfully refreshed access token")
}

0 comments on commit d09fdeb

Please sign in to comment.