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

fix(realtime_client): Prevent sending expired tokens #1095

Merged
merged 7 commits into from
Dec 16, 2024

Conversation

dshukertjr
Copy link
Member

@dshukertjr dshukertjr commented Dec 10, 2024

What kind of change does this PR introduce?

Adds a check of whether the JWT is expired before sending it to realtime. This helps the realtime logs to be filled with bunch of expired JWT token logs.

Equivalent of supabase/realtime-js#437 and partly supabase/realtime-js#439 from realtime-js

@dshukertjr dshukertjr changed the title fix(realtime_client): prevent sending expired tokens fix(realtime_client): Prevent sending expired tokens Dec 10, 2024
@grdsdev grdsdev linked an issue Dec 10, 2024 that may be closed by this pull request
@dshukertjr dshukertjr marked this pull request as draft December 11, 2024 09:16
@dshukertjr dshukertjr marked this pull request as ready for review December 12, 2024 05:27
null,
Level.FINE,
);
throw FormatException(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the js client doesn't throw an exception, but logs the issue and then fails silently. I think it's better to not throw, because setAuth is used in other places, where they might re-set the same access token which is then expired, but it shouldn't throw in those cases. Or we add try catch to those cases.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch! I forgot to add, but the way js client handles the expired JWT changes in another PR though. supabase/realtime-js#439

@dshukertjr dshukertjr requested a review from Vinzent03 December 15, 2024 14:22
@dshukertjr dshukertjr merged commit 1bb034f into main Dec 16, 2024
9 checks passed
@dshukertjr dshukertjr deleted the fix/realtime-token branch December 16, 2024 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Request: Prevent sending expired tokens to Realtime channel
2 participants