Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: The lost of refresh token in Google OAuth #763

Open
1 task done
figwood opened this issue Mar 18, 2024 · 0 comments
Open
1 task done

[Bug]: The lost of refresh token in Google OAuth #763

figwood opened this issue Mar 18, 2024 · 0 comments
Assignees
Labels
API-Service Backend Java Spring for the Lowcoder API Enhancement New feature or request Java Backend Pull requests that update Java code

Comments

@figwood
Copy link

figwood commented Mar 18, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When login with Google account, it will return an access_token and an refresh_token, the access_token will be expired in about an hour, but the refresh_token will be valid all the time and it is used to get a new access_token, see here . In lowcoder, both of them will be stored in DB, but the problem is that the refresh_token will only be returned in the first time user login, if users logout and re-login, it will return null in refresh_token and once it has been stored in DB, we will lose refresh_token.

Without refresh_token, the access_token can't be refreshed automatically, users have to re-login again every hour, which is quite annoying.

It could be easily solved by adding these code in updateConnection function, ,

        //if auth by google, set refresh token
        if (authUser.getSource().equals(AuthSourceConstants.GOOGLE)) {
            authUser.getAuthToken().setRefreshToken(oldConnection.getAuthConnectionAuthToken().getRefreshToken());
        }

but it's too ugly, hope there could be any better solutions.

Expected Behavior

Users don't have to re-login every hour after login with Google account.

Steps to reproduce

  1. login with Google account
  2. logout
  3. re-login with same Google account
  4. wait an hour, refresh the page, it will redirect to login form

Environment

No response

Additional Information

No response

@FalkWolsky FalkWolsky added Enhancement New feature or request Java Backend Pull requests that update Java code API-Service Backend Java Spring for the Lowcoder API labels Apr 19, 2024
th37rose added a commit to th37rose/lowcoder_dev1 that referenced this issue Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API-Service Backend Java Spring for the Lowcoder API Enhancement New feature or request Java Backend Pull requests that update Java code
Projects
Status: No status
Development

No branches or pull requests

3 participants