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
REST API endpoint /users changes do not get reflected to the client app #1939
Comments
Yes, I am aware of this. The reason is that the prod/eval property comes from the JWT and old eval token is still valid so it's not forcibly refreshed unless eval was expired. We probably need a method in db.cloud to forcibly refresh the token. Before this is in place, one workaround is to do the following: db.$logins.toCollection().modify({accessTokenExpiration: 1}); This will make dexie-cloud believe it needs to refresh its token. |
Calling the above seems to work; however, works only on the device that we called it from. On user's other devices token is still not refreshed. Is there a workaround that we can call from the server side to force refresh tokens in all devices that user has logged in? Also, I've tried delaying the call above to avoid errors; however, I still get these, 1 warning & 1 error: |
The cloud service (staging) is now updated to push out any updates of the user license status so that all connected clients get it reflected immediately. However, if a user's license has expired, it will not keep an open connection to the cloud anymore and the only way to refresh the status of the user is by calling db.cloud.sync(). The workaround I proposed earlier should not be used since it is not needed anymore. Please help me verify this, and I can push the update out to production. To check if your cloud database is on staging (and has the update), browse to <your DB URL>/version. It should be 1.5.0 or higher. |
Thank you David, this was the last missing piece for me and works like a charm. Below is a short demo using Stripe, albeit low quality due to size limitations. I no longer observe any errors in the console logs during the operation. I call Database version shows as ScreenShot.2024-04-10.at.08.30.14-converted.mp4 |
@oyalhi Looking really good. Dexie Cloud has become really powerful with these new updates. |
Looks very good indeed. Anyone building something similar for Paypal subscriptions? |
We have a stripe webhook on our server, when a customer purchases a subscription, the hook gets triggered.
After validations, we get the dexie user, change it's type to
prod
oreval
depending on if they've subscribed or unsubscribed. This operation is successful on the server side.However, we cannot observe the user type being updated in our client app. Even after refreshes customer still shows as
eval
. Only after log off and log back in does the user correctly reflect the change.Is this a known bug? Or are there alternative ways to change user's type in a way that will be reflected on the client side (almost) immediately?
The text was updated successfully, but these errors were encountered: