Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@psychic-api/link

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@psychic-api/link

`@psychic-api/link` is a React library that provides a hook for easy authentication with popular SaaS applications such as Notion, Google Drive, and more. Find us at https://psychic.dev

  • 1.0.9
  • npm
  • Socket score

Version published
Weekly downloads
43
increased by7.5%
Maintainers
2
Weekly downloads
 
Created
Source

@psychic-api/link is a React library that provides a hook for easy authentication with popular SaaS applications such as Notion, Google Drive, and more. Find us at https://psychic.dev

Table of Contents

Installation

Install the library using npm:

npm install @psychic-api/link

Usage

Here's an example of how to use the library:

import React, { useEffect, useState } from 'react';
import { usePsychicLink } from '@psychic-api/link';

const App = () => {
  const [newConnection, setNewConnection] = useState(null);
  // Your Psychic.dev public API key
  const publicKey = '5c362fda-bb72-4a6c-b930-71f33ad45f79';
  
  // Unique ID for the account that is requesting this connection
  const accountId = '2cbaa840-0b21-4d8e-924c-e418a08ce53f';

  // usePsychicLink accepts a callback that handles your application logic once a new connection is established
  const { open, isReady, isLoading, error } = usePsychicLink(publicKey, (newConnection: {accountId: string, connectorId: string}) => setNewConnection(newConnection));

  useEffect(() => {
    // Shows the Psychic Link modal to the user
    open(accountId);
  }, []);

  return (
    <div className="App">
      {newConnection && <div>{newConnection}</div>}
    </div>
  );
};

export default App;

Troubleshooting

For assistance, join the Psychic community Slack here

Invalid Hook Call Warning

If you encounter an "Invalid hook call" warning when importing the library into another project, it might be caused by the library using a different version of React than the project. To resolve this issue, follow the instructions provided in this StackOverflow post: Invalid hook call warning - linking a React app and a local npm package

FAQs

Package last updated on 28 Jun 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