GODT-1524: Logout issues with macOS.

This commit is contained in:
Jakub
2022-03-14 16:37:42 +01:00
parent 2d5ea669a5
commit 6671dd38ea
26 changed files with 411 additions and 135 deletions

View File

@ -133,14 +133,32 @@ func (api *FakePMAPI) authRefresh() error {
session, err := api.controller.refreshSessionIfAuthorized(api.uid, api.ref)
if err != nil {
if pmapi.IsFailedAuth(err) {
go api.handleAuth(nil)
}
return err
}
api.ref = session.ref
api.acc = session.acc
go api.handleAuth(&pmapi.AuthRefresh{
UID: api.uid,
AccessToken: api.acc,
RefreshToken: api.ref,
ExpiresIn: 7200,
Scopes: []string{"full", "self", "user", "mail"},
})
return nil
}
func (api *FakePMAPI) handleAuth(auth *pmapi.AuthRefresh) {
for _, handle := range api.authHandlers {
handle(auth)
}
}
func (api *FakePMAPI) setUser(username string) error {
api.username = username
api.log = api.log.WithField("username", username)