npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

auth-service-module-prodio

v1.0.7

Published

NPM for consuming prodio auth service

Downloads

4

Readme

auth-service-module-prodio

Build Status

auth-service-module-prodio is an node js client for the auth-service-prodio API. Integrate in to any application to perform auth releted user journeys.

Features!

  1. Signup/Register Account
  2. Verify Account
  3. Regenerate OTP/verification token
  4. Login
  5. List Accounts
  6. Forgot Password
  7. Reset Password
  8. Unregister/Deactivate Account

Prerequisite:

  • Clone this repository on your server git clone https://github.com/ProdioDesignWorks/auth-service-prodio.git
  • Navigate to your repo cd auth-service-prodio
  • Install dependencies npm install
  • Start service node . or npm start or node server/server.js
  • If you've pm2 installed then use this pm2 start server/server.js --name="AUTH_SERVICE"

Note:

auth-service-prodio uses loopback as the core framework for developing API's, so all customisations, configurations, middlewares, events, and db connectors can be used which you would have used in loopback.

Installation

$ npm install auth-module-prodio --save

Initialization

Require the auth-module-prodio module and initialize the notificationSdk client.


 const auth = require('auth-service-module-prodio');
 const authModule = new auth("API BASE PATH OF AUTH SERVICE");//http://domainname:3005/api

Method

1. Signup/Register: This will create/register a new account.

Payload

| Key | Type | Value | Description | Required | | --- | ---- | ----- | ----------- | -------- | | action | string | REGISTERACCOUNT | key which defines the type of action to be performed | YES | | meta | json | refer example below | - | YES |

Example

	const emailMetaInfo = {
		"email": "",
		"password": ""
	};
	const otpMetaInfo = {
		"phone": ""
	}
	const  payload = {
		"action": "REGISTERACCOUNT",
		"meta": emailMetaInfo // or otpMetaInfo
	};
	let account = authModule.execute(payload);

2. Verify Account Token: This will verify an account.

Payload

| Key | Type | Value | Description | Required | | --- | ---- | ----- | ----------- | -------- | | action | string | VERIFYTOKEN | key which defines the type of action to be performed | YES | | meta | json | refer example below | - | YES |

Example

	const emailMetaInfo = {
		"verificationToken": ""
	};
	const otpMetaInfo = {
		"phone": "",
		"otp": ""
	}
	const  payload = {
		"action": "VERIFYTOKEN",
		"meta": emailMetaInfo // or otpMetaInfo
	};
	let verify = authModule.execute(payload);

3. Generate email verification token or otp: This will regenerate verification tokens.

Payload

| Key | Type | Value | Description | Required | | --- | ---- | ----- | ----------- | -------- | | action | string | GENERATETOKEN | key which defines the type of action to be performed | YES | | meta | json | refer example below | - | YES |

Example

	const emailMetaInfo = {
		"email": ""
	};
	const otpMetaInfo = {
		"phone": ""
	}
	const  payload = {
		"action": "GENERATETOKEN",
		"meta": emailMetaInfo // or otpMetaInfo
	};
	let token = authModule.execute(payload);

4. Login: This will validate login of an account if email based. If otp based, will generate an otp which will have to verified using verify account token method(2).

Payload

| Key | Type | Value | Description | Required | | --- | ---- | ----- | ----------- | -------- | | action | string | LOGIN | key which defines the type of action to be performed | YES | | meta | json | refer example below | - | YES |

Example

	const emailMetaInfo = {
		"email": "",
		"password":""
	};
	const otpMetaInfo = {
		"phone": ""
	}
	const  payload = {
		"action": "LOGIN",
		"meta": emailMetaInfo // or otpMetaInfo
	};
	let login = authModule.execute(payload);

5. List accounts: This will list all the accounts.

Payload

| Key | Type | Value | Description | Required | | --- | ---- | ----- | ----------- | -------- | | action | string | LISTACCOUNTS | key which defines the type of action to be performed | YES | | meta | json | refer example below | - | YES |

Example

	const  payload = {
		"action": "LISTACCOUNTS"
	};
	let accounts = authModule.execute(payload);

6. Forgot Password: Only for email based auth. It will generate an token which will be required when resetting the password.

Payload

| Key | Type | Value | Description | Required | | --- | ---- | ----- | ----------- | -------- | | action | string | FORGOTPASSWORD | key which defines the type of action to be performed | YES | | meta | json | refer example below | - | YES |

Example

	const emailMetaInfo = {
		"email": ""
	};
	const  payload = {
		"action": "FORGOTPASSWORD",
		"meta": emailMetaInfo
	};
	let forgot = authModule.execute(payload);

7. Reset Password: Only for email based auth. Based on the token generated in forgot password, new password can be created.

Payload

| Key | Type | Value | Description | Required | | --- | ---- | ----- | ----------- | -------- | | action | string | RESETPASSWORD | key which defines the type of action to be performed | YES | | meta | json | refer example below | - | YES |

Example

	const emailMetaInfo = {
		"verificationToken": "",
		"password": ""
	};
	const  payload = {
		"action": "RESETPASSWORD",
		"meta": emailMetaInfo
	};
	let reset = authModule.execute(payload);

8. Change Password: Only for email based auth. Change an existing password.

Payload

| Key | Type | Value | Description | Required | | --- | ---- | ----- | ----------- | -------- | | action | string | CHANGEPASSWORD | key which defines the type of action to be performed | YES | | meta | json | refer example below | - | YES |

Example

	const emailMetaInfo = {
		"email": "",
		"oldPassword": "",
		"newPassword": ""
	};
	const  payload = {
		"action": "CHANGEPASSWORD",
		"meta": emailMetaInfo
	};
	let change = authModule.execute(payload);

8. Delete Account: Will delete the account and no other action can be done using the account further.

Payload

| Key | Type | Value | Description | Required | | --- | ---- | ----- | ----------- | -------- | | action | string | DELETEACCOUNT | key which defines the type of action to be performed | YES | | meta | json | refer example below | - | YES |

Example

	const emailMetaInfo = {
		"email": "",
	};
	const otpMetaInfo = {
		"phone": ""
	}
	const  payload = {
		"action": "DELETEACCOUNT",
		"meta": emailMetaInfo // or otpMetaInfo
	};
	let delete = authModule.execute(payload);