FAForever / website

FAForever's Website
http://www.faforever.com
MIT License
21 stars 36 forks source link

[auth] sometimes the user needs to login multiple times #529

Open fcaps opened 10 months ago

fcaps commented 10 months ago

there is an issue if you login and hydra is redirecting you back to the website callback, you will be directly redirected to login again. we have to investigate what is happening on production, since i cannot reproduce it locally/xzy.

we could start searching for this log:

// security/bootPassport.js
      const oAuthPassport = {
            token,
            refreshToken
        }

        const apiClient = JavaApiClientFactory.createInstance(new UserService(), appConfig.apiUrl, oAuthPassport)
        const userRepository = new UserRepository(apiClient)

        userRepository.fetchUser(oAuthPassport).then(user => {
            verified(null, user)
        }).catch(e => {
            console.error('[Error] oAuth verify failed with "' + e.toString() + '"')
            verified(null, null)
        })

maybe the callback itself is not valid (url produced by hydra), by having a bad code/token. so we need to capture all urls in the browser.

fcaps commented 10 months ago

UPDATE: the logs show different errors, but not the "verify failed", we should disable the auto-redirect to "/login" if something fails and show log the error as "login-failed" or something.