summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/api.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/api.go b/src/api.go
index 6f3d847..93c1c42 100644
--- a/src/api.go
+++ b/src/api.go
@@ -38,8 +38,9 @@ func (server *Server) apiAuthenticatedRetry(method string, endpoint string, opts
if bodyErr != nil {
var error *HTTPStatusError
- if errors.As(bodyErr, &error) {
- GetVPNState().Log(LOG_INFO, fmt.Sprintf("API: Got HTTP error %v, retrying authenticated", bodyErr))
+ // Only retry authenticated if we get a HTTP 401
+ if errors.As(bodyErr, &error) && error.Status == 401 {
+ GetVPNState().Log(LOG_INFO, fmt.Sprintf("API: Got HTTP error %v, retrying authenticated", error))
// Tell the method that the token is expired
server.OAuth.Token.ExpiredTimestamp = GenerateTimeSeconds()
return server.apiAuthenticated(method, endpoint, opts)