fixed reauth
This commit is contained in:
parent
59b836b40a
commit
620636fb36
@ -56,6 +56,8 @@ func (a *App) CheckPrerequisites() {
|
||||
a.Auth, err = TokenRefresh(*a, a.Auth)
|
||||
if err == nil {
|
||||
authenticated = true
|
||||
} else {
|
||||
fmt.Printf("token reauth failed, requesting device code: %s\n", err)
|
||||
}
|
||||
}
|
||||
if !authenticated {
|
||||
|
@ -12,7 +12,6 @@ import (
|
||||
wruntime "github.com/wailsapp/wails/v2/pkg/runtime"
|
||||
)
|
||||
|
||||
|
||||
type LauncherAuth struct {
|
||||
Id string
|
||||
Name string
|
||||
@ -150,6 +149,9 @@ func TokenRefresh(app App, auth authenticationResp) (authenticationResp, error)
|
||||
data, _ := io.ReadAll(resp.Body)
|
||||
authResp := authenticationResp{}
|
||||
json.Unmarshal(data, &authResp)
|
||||
if authResp.Error != "" {
|
||||
return authResp, fmt.Errorf("unable to request new token: %s", authResp.Error_description)
|
||||
}
|
||||
return authResp, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user