@basiq/connect-auth
TypeScript icon, indicating that this package has built-in type declarations

1.0.13 • Public • Published

BASIQ CONNECT COMPONENT

The Basiq Connect Auth is a ReactJS UI component exposed to partners who prefer to implement the auth flow as an external component with an SMS OTP built in. When rendered, it will take the user through an SMS OTP flow and then proceed to redirect them to the Basiq Consent UI flow to connect their accounts.

Note: This has been offered as interim solution for partners who require access to v3 of the API before we have released the upgrades to https://connect.basiq.io/. If you have any questions regarding this please reach out to support@basiq.io.

Setup

  1. Install @basiq/connect-auth and import the component
$ npm install @basiq/basiq-connect-control
import { BasiqConnect } from "@basiq/connect-auth";
  1. Generate a new Auth Link, and retrieve the auth link ID from the public URL that is returned.
    
  try {
    const { data } = await axios.get(
      `https://au-api.basiq.io/users/{userId}/auth_link`,
      {
        method: 'post',
        headers: {
          Authorization: `Bearer ${YOUR_SERVER_ACCESS_TOKEN}`,
          Accept: 'application/json',
          'Content-Type': 'application/json',
        },
      }
    );

    let auth_id = data.links.public.replace('https://connect.basiq.io/','');

    return auth_id;

  } catch (error) {
    console.log(error)
  }
  1. Drop the component in your code on the page you wish to call it. The component will retrieve the auth_id from the URL so failing to include it there will result in an error. Note that the component is full page and will eventually handle the redirect to the Basiq Consent UI, so it should be rendered on it's own page (or conditionally, after appending an auth_link ID)
// Component rendered at /auth-link/:auth_id

export default function Auth() {
  return (
      <main>
        <BasiqConnect />
      </main>
  );
}

Readme

Keywords

none

Package Sidebar

Install

npm i @basiq/connect-auth

Weekly Downloads

6

Version

1.0.13

License

ISC

Unpacked Size

1.26 MB

Total Files

9

Last publish

Collaborators

  • ashmanmalik
  • andreja
  • basiq-dev
  • katarina.bantic
  • mladen_basiq
  • supercvetic
  • stefanabasiq