summaryrefslogtreecommitdiff
path: root/src/state.go
diff options
context:
space:
mode:
authorJeroen Wijenbergh <jeroenwijenbergh@protonmail.com>2022-04-19 12:28:54 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-04-19 12:28:54 +0200
commitfb2f57cfcbb6408130e1cc75bd36c896502b78e0 (patch)
treea8ce43925443d9152e7408edce7adb3307204361 /src/state.go
parent1b798f8da29ad90506c6d716858ecb2dd782507f (diff)
OAuth improvements: Also ensure tokens based on config state
Diffstat (limited to 'src/state.go')
-rw-r--r--src/state.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/state.go b/src/state.go
index c6f0f79..23bc1cd 100644
--- a/src/state.go
+++ b/src/state.go
@@ -76,12 +76,16 @@ func (state *VPNState) Connect(url string) (string, error) {
return "", initializeErr
}
- if !state.Server.IsAuthenticated() {
+ // Relogin with oauth
+ // This moves the state to authenticated
+ if state.Server.NeedsRelogin() {
loginErr := state.LoginOAuth()
if loginErr != nil {
return "", loginErr
}
+ } else { // OAuth was valid, ensure we are in the authenticated state
+ state.GoTransition(AUTHENTICATED, "")
}
config, configErr := state.Server.GetConfig()