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

Add channels auth via JWT verification #99

Merged
merged 1 commit into from
Jan 10, 2021

Conversation

w3b6x9
Copy link
Member

@w3b6x9 w3b6x9 commented Jan 8, 2021

What kind of change does this PR introduce?

Feature

What is the current behavior?

Channels are not secured

What is the new behavior?

Channels are secured by setting SECURE_CHANNELS=true and JWT_SECRET=your-secret

Additional context

  • By default in development mode everything should still work.

  • To test out channels auth set SECURE_CHANNELS=true and JWT_SECRET (e.g. secret123). I've been using http://jwtbuilder.jamiekurtz.com to generate JWTs and to play around with expiration and claims.

  • I've been using the next-js example and passing the token param to Socket in realtime/examples/next-js/pages/index.js: this.socket = new Socket(REALTIME_URL, { params: { token: 'token123' } })

  • To validate claims set JWT_CLAIM_VALIDATORS(e.g. {"iss": "Online JWT Builder", "aud": "www.example.com"}).

This addresses issue #95.

@w3b6x9 w3b6x9 marked this pull request as ready for review January 8, 2021 06:54
@DoubleOTheven
Copy link

Nice work!

@soedirgo
Copy link
Member

Tested on Supabase AMIs - once again, awesome work @w3b6x9!

@soedirgo soedirgo merged commit 0a288e0 into supabase:master Jan 10, 2021
@github-actions
Copy link

🎉 This PR is included in version 0.10.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

soedirgo added a commit that referenced this pull request Jan 19, 2021
This is a followup to #99. All this means is it's no longer required for
users to specify `SECRET_KEY_BASE` (which we don't use anyway).
soedirgo added a commit that referenced this pull request Jan 20, 2021
This is a followup to #99. All this means is it's no longer required for
users to specify `SECRET_KEY_BASE` (which we don't use anyway).
soedirgo added a commit that referenced this pull request Jan 20, 2021
This is a followup to #99. All this means is it's no longer required for
users to specify `SECRET_KEY_BASE` (which we don't use anyway).
@w3b6x9 w3b6x9 mentioned this pull request May 4, 2021
kiwicopple pushed a commit to kiwicopple/realtime that referenced this pull request Jun 9, 2021
kiwicopple pushed a commit to kiwicopple/realtime that referenced this pull request Jun 9, 2021
This is a followup to supabase#99. All this means is it's no longer required for
users to specify `SECRET_KEY_BASE` (which we don't use anyway).
w3b6x9 pushed a commit that referenced this pull request Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants