@vocably/pontis
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

@vocably/pontis

npm package

@vocably/pontis makes login into Chrome extension via the AWS Amplify website easy-peasy.

Installation

npm install @vocably/pontis @aws-amplify/core --save

How to use

// website-app/index.js

import { Auth } from '@aws-amplify/auth';
import { AppAuthStorage } from '@vocably/pontis';

const extensionId = 'baocigmmhhdemijfjnjdidbkfgpgogmb';

Auth.configure({
  // The following line sets up the custom storage
  // which exchages auth tokens with the extension
  storage: new AppAuthStorage(extensionId),
  // and the rest of Auth params:
  region: 'eu-central-1',
  userPoolId: 'eu-central-1_uSErPooL',
  //etc...
});
// extension/service-worker.js
import { registerExtensionStorage } from '@vocably/pontis';
import { Auth } from '@aws-amplify/auth';

// The only function param is responsible for
// the storage type. It could be 'sync' or 'local'
const storage = registerExtensionStorage('sync');

Auth.configure({
  // The following line sets up the custom extension
  // storage which exchanges Auth tokens with the app
  storage: storage,
  // and the rest of Auth params:
  region: 'eu-central-1',
  userPoolId: 'eu-central-1_uSErPooL',
  //etc...
});

That's it.

Feel free to check @vocably/hermes if you love painless promise-based messages exchange between the extension and the app.

Package Sidebar

Install

npm i @vocably/pontis

Weekly Downloads

25

Version

1.0.2

License

MIT

Unpacked Size

24.5 kB

Total Files

27

Last publish

Collaborators

  • sneasio