![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
@front-finance/link
Advanced tools
Readme
JS library for integrating with Front Finance
With npm
:
npm install --save @front-finance/link
With yarn
yarn add @front-finance/link
Connection link should be obtained from the GET /api/v1/cataloglink
endpoint. Api reference for this request is available here. Request must be preformed from the server side because it requires the client secret. You will get the response in the following format:
{
"content": {
"url": "https://web.getfront.com/broker-connect?auth_code={authCode}",
"iFrameUrl": "https://web.getfront.com/b2b-iframe/{clientId}/broker-connect?auth_code={authCode}"
},
"status": "ok",
"message": ""
}
You can use iFrameUrl
from this response to open the popup window with openPopup
method. url
field is used to open link in the same tab by openLink
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 <></>
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.
âšī¸ See src/types/index.ts for exported types.
createFrontConnection
argumentskey | type | description |
---|---|---|
clientId | string | Keys from https://dashboard.getfront.com/company/keys page |
onBrokerConnected | (payload: FrontPayload) => void | Callback called when users connects their accounts |
onExit | ((error?: string | undefined) => void) | undefined | Called if connection not happened |
createFrontConnection
return valuekey | type | description |
---|---|---|
openLink | (link: string) => Promise<void> | Opens url in same tab. |
openPopup | (iframeUrl: string) => Promise<void> | Opens url in popup |
closePopup | () => Promise<void> | Closes popup window |
You can use broker tokens to perform requests to get current balance, assets and execute transactions. Full API reference can be found here.
TypeScript definitions for @front-finance/link
are built into the npm package.
FAQs
Front Finance accounts connection client lib
The npm package @front-finance/link receives a total of 416 weekly downloads. As such, @front-finance/link popularity was classified as not popular.
We found that @front-finance/link demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.