Socket
Socket
Sign inDemoInstall

@front-finance/link

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@front-finance/link

Front Finance accounts connection client lib


Version published
Weekly downloads
225
decreased by-38.69%
Maintainers
1
Weekly downloads
 
Created
Source

JS library for integrating with Front Finance

Install

With npm:

npm install --save @front-finance/link

With yarn

yarn add @front-finance/link

Generating connection method

import { createFrontConnection } from '@front-finance/link';

// ...

const frontConnection = createFrontConnection({
  clientId: '<Your Front Finance Client Id>',
  onBrokerConnected: (brokerData: FrontPayload) => {
    // use broker account data
  },
  onExit: (error?: string) => {
    if (error) {
      // handle error
    } else {
      // ...
    }
  }

To open authentication link rpovided by Front Finance Integration API you need to call openPopup method:

frontConnection.openPopup(authLink)

ℹ️ See full source code example at react-example/src/ui/Front.tsx

import {
  createFrontConnection,
  FrontConnection,
  FrontPayload
} from '@front-finance/link'

// ...

const [frontConnection, setFrontConnection] = useState<FrontConnection | null>(
  null
)

useEffect(() => {
  setFrontConnection(createFrontConnection(options))
}, [])

useEffect(() => {
  if (authLink) {
    frontConnection?.openPopup(authLink)
  }
}, [frontConnection, authLink])

return <></>

Getting tokens

After successfull authentication on Front Finance user will be redirected back to provided callback URL. FrontConnection instance will check if URL contains query parameters, load broker tokens and fire the events.

Available Connection configuration options

ℹ️ See src/types/index.ts for exported types.

createFrontConnection arguments
keytype
clientIdstring
onBrokerConnected(payload: FrontPayload) => void
onExit((error?: string | undefined) => void) | undefined
createFrontConnection return value
keytype
openLink() => Promise<void>

Typescript support

TypeScript definitions for @front-finance/link are built into the npm package.

FAQs

Package last updated on 15 Feb 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc