Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.privy.io/llms.txt

Use this file to discover all available pages before exploring further.

Using the access token

Once the user has authenticated with the provider app. You can get their access token for making requests directly to the provider app using useGetAccessTokenForProvider.
import {useGetAccessTokenForProvider} from '@privy-io/react-auth';

function Button() {
  const {getAccessTokenForProvider} = useGetAccessTokenForProvider();

  return (
    <button
      onClick={async () => {
        const {token} = await getAccessTokenForProvider();
        if (token) {
          const res = await getDataFromProviderApp(token);
        }
      }}
    >
      Make API request to provider
    </button>
  );
}