Git Product home page Git Product logo

pusher-channels-auth-example's Introduction

Pusher Channels Example Auth Server

This project aims to demonstrate how to implement a Pusher authorization endpoint using the pusher-http-node library. There's no concept of users - a valid token is provided to every request - so this shouldn't be used in production.

Some Assembly Required

BEFORE you run this project you'll need an appId, appKey, appSecret and cluster for Pusher. You can get these from the keys tab of your pusher dashboard

Deploy to Heroku

You'll need to insert your appId, appKey, appSecret and cluster when deploying your app.

Deploy

Run It Locally

Make a copy of the .env.example file.

cp .env.example .env

Add your appId, appKey, appSecret and cluster to the newly created .env file.

When you have a .env file containing a valid APP_ID APP_KEY, APP_SECRET and CLUSTER you're ready to run.

yarn
yarn start

That's it. You can test everything works by sending a POST request to http://localhost:3030/pusher/auth

curl -X POST http://localhost:3030/pusher/auth \
  -H "Content-Type: application/json" \
  -d '{"socket_id": "100.100", "channel_name": "private-document"}'

Using E2E encryption

To test E2E encryption, generate a random 32 byte master key, base64 encode it and add it to your .env as ENCRYPTION_MASTER_KEY, then use a channel with an encrypted name prefix, e.g.

curl -X POST http://localhost:3030/pusher/auth \
  -H "Content-Type: application/json" \
  -d '{"socket_id": "100.100", "channel_name": "private-encrypted-document"}'

The response should contain an additional shared_secret key and value.

A suitable key can be generated like this:

openssl rand -base64 32

pusher-channels-auth-example's People

Contributors

daniellevass avatar dependabot[bot] avatar leesio avatar mdpye avatar oliverpearmain-pusher avatar sonologico avatar willsewell avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.