# Quick Start

A quick start example of using the Endpass Connect library in your web app.

Example App

# 1. Register Application

Visit the Endpass dashboard and create a new application.

Save your Client ID for use later in this tutorial.

More about application registration

# 2. Add Endpass Connect Library

Run one of these commands to install the Endpass Connect library

# If using npm
npm i --save @endpass/connect

# If using yarn
yarn add @endpass/connect

Import Endpass connect OAuth plugin as html script tag

<!-- Import OAuth plugin as html script tag -->
<script
  src="https://unpkg.com/@endpass/connect@latest/oauth.min.js"
  type="text/javascript"
></script>
<script>
  (() => {
    // all Endpass plugins available from window
    const EndpassOauth = window.EndpassOauth;

    // Insert your client ID here
    const YOUR_CLIENT_ID = '';

    // Initialize Connect with clientId from vault
    const connect = new EndpassOauth({
      clientId: YOUR_CLIENT_ID,
      // Choose popup separate window or modal iframe (default modal)
      isPopup: false,
    });
  })();
</script>

Add the library to your application using the npm or script tag method.

More about installing the Endpass Connect library

If you need to combine plugins, please use Compose Plugin for this

# 3. Request User Information

// If you are using modules or npm
import EndpassOauth from '@endpass/connect/oauth';

// Insert your client ID here
const YOUR_CLIENT_ID = '';

// Initialize a new client instance
const connect = new EndpassOauth({
  clientId: YOUR_CLIENT_ID,
});

// Call the client's request method with any API endpoint
connect.request('/v1/user').then(console.log);

Initialize a new instance of the client with the scopes required for your application.

Call the connect.request method to request information from the user. This method will open a window allowing the user to log in and grant permissions based on your application.

For example, connect.request('/v1/user') will return a promise with basic user information.

List of scopes