Giter VIP home page Giter VIP logo

jwt-pubnub-functions's Introduction

JWT-PubNub-Functions

This repository has a sample PubNub function that generates JSON Web Token for authorization to use Google Drive's Rest API.

QuickStart

  1. Sign Up for PubNub and create a new Project.
PubNub Signup
  1. Copy and Paste the code from file completeAuth.js into a new PubNub function called completeAuth.

  2. Create a service account that grants us the necessary permissions to access certain data stored on Google Cloud. To do this head over to your Google Cloud Console. Find your project or create a new one if you do not have one already. Then, inside your project, head to IAM and Admin then Service Accounts. Here click Create New Service Account and choose the role Service Account Admin. Select Furnish a new Private Key and once you create your service account, the console will download the JSON file with your private key onto your computer. Now we have successfully created the service account. Make sure to keep the JSON file with the service account credentials safe on your computer, as we will need these credentials later.

  3. Enter the private key and service account email address where it says to insert them in the PubNub Functions code.

  4. Create a new Sample Document, with the text, "This is a sample document!".

  5. Find the document by using its file ID. In order to obtain the file ID of your document, navigate to your share button and it will be inside the URL.

  6. In the getDriveFileURL insert this ID, where it says to.

  7. Ensure that your PubNub functions module is running so that the server side code you have written is deployed and active.

  8. Press the Get button to make a sample request to your PubNub function. It should log the body of the document, "This is a sample document!".

jwt-pubnub-functions's People

Contributors

kaushikravikumar 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.