0.1.3 • Published 11 months ago

cycurid-oauth2-client v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

cycurid-oauth2-client

cycurid-oauth2-client is CycurID's solution to authentication and onboarding through the power of a Reusable Digital Identity Token. Users register with CycurID to create a Reusable Encrypted Zero-Knowledge Identity Token that they present to your company's onboarding or authentication platform, letting them seamlessly and instantly connect.

Installation

Use the package manager npm to install cycurid-oauth2-client.

npm install cycurid-oauth2-client

Usage

Import

IMPORT IN REACT:

import { Barcode } from 'cycurid-oauth2-client'

Supported methods

Barcode

This component will generate a barcode which then can be scanned using the Imme app. After a user successfully scans and approves the OAuth request a code is sent to the redirect URL in the params that can be used at a later stage to get an authToken. The cycurid-oauth2-server package provides functions for retrieving the authToken and client data requested in the scope.

Example

import { Barcode } from 'cycurid-oauth2-client';


const MyComponent=()=>{

const config = {
  clientID: '<YOUR_CLIENT_ID>',
  redirectURL: '<YOUR_REDIRECT_URL>',
  scopes: ['<YOUR_SCOPES_ARRAY>'],
  action: '<YOUR_ACTION>',
  entity_name: '<YOUR_ENTITY_NAME>',
  size:'<SIZE OF QR CODE>'
  overwriteRules: {
      age_min: '<MIN AGE>',
      age_max: '<MAX AGE>',
      country: '<ALLOWED_COUNTRY_ISO_ARRAY>'
      }
};


 return(<Barcode config={config} />)

  }

Example 2

import { Barcode } from 'cycurid-oauth2-client'

const MyComponent = () => {
  const config = {
    clientID: 'J8mCZcjkBiwIhs1U6jjbLvRR',
    redirectURL: 'https://my_redirect_url.com/login',
    scope: ['reference_uuid', 'first_name'],
    overwriteRules: {
      age_min: 15,
      age_max: 100,
      country: ['CA', 'US'],
    },
    action: 'login',
    entityName: 'test merchant',
    size: 250,
  }

  return <Barcode config={config} />
}

config

This is your configuration object for the client. The config is passed into each of the methods with optional overrides.

  • clientID - (STRING) The ID provided to you from CycurID Portal Website see Account Creation for more details.
  • redirectURL - (STRING) This is the URL that the request is initially used to initiate the OAuth process. This URL needs to match the provided URL associated with the client account. The widget response will be sent to this address.
  • scopes - (ARRAY OF STRINGS) An array of what user information you want to be returned.
  • action - (STRING) This specifies the objective that you want the user to accomplish currently, we support 'login' and 'register'.
  • entity_name - (STRING) OPTIONAL_KEY, this will change the name displayed on the widget.
  • size - OPTIONAL_KEY (NUMBER), defaults to 200, this determines the size widget.
  • overwriteRules - OPTIONAL_KEY (OBJECT), Allows for overwrite of individual rules (age_min, age_max, country)
    • age_min - OPTIONAL_KEY (NUMBER), Change minimum age requirement for user
    • age_max - OPTIONAL_KEY (NUMBER), Change maximum age requirement for user
    • country - OPTIONAL_KEY (ARRAY OF ISO2 COUNTRY CODES STRINGS), Change Allowed Countries for user

Account Creation

An Cycurid Account is required to use this package

To create an account, navigate to CycurID Portal Website and click Create An Account to start verifying users' identity with CycurID.

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT License

Copyright (c) 2022 CycurID

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.