npm.io
2.4.0 • Published 6 years ago

package_murugoauth_web-js

Licence
ISC
Version
2.4.0
Deps
0
Size
3 kB
Vulns
0
Weekly
0

To install the plugin, do the following:

const murugoAuth = require("package_murugoauth_web-js");

The package is rendered by calling murugoAuth.

Reference

  • auth.loggedIn(), returns user's data and store them in localStorage.
  • auth.logOut(token), logs the user's session out on Murugo Cloud. token parameter is sent along with this function.

Example

To access user's data, you can do the following:

Javascript
const murugoAuth = require("package_murugoauth_web-js");
const auth = new murugoAuth();
// Function to identify user's data and save them in localStorage.
auth.loggedIn();
// Get murugo_user stored in localStorage under 'murugo_user' key.
let murugo_user = JSON.parse(localStorage.getItem("murugo_user"));

To logout:

logout() {
    // Logged in token of the user.
      let token = this.token
      const murugoAuth = require("package_murugoauth_web-js");
      const auth = new murugoAuth(token);
      // Log out function. token as parameter.
      auth.logOut(token);
    }
    ```