Skip to main content
The useIssueJwt hook issues a signed JWT that your backend can verify to authenticate the current Para user. Useful for linking Para sessions to your own API.

Import

import { useIssueJwt } from "@getpara/react-native-wallet";

Usage

import { useIssueJwt } from "@getpara/react-native-wallet";
import { Button } from "react-native";

function BackendAuthButton() {
  const { issueJwtAsync, isPending } = useIssueJwt();

  const handleIssue = async () => {
    try {
      const { token, keyId } = await issueJwtAsync({});
      // Send token to your backend for verification
      await fetch("https://api.example.com/auth", {
        method: "POST",
        headers: { Authorization: `Bearer ${token}` },
        body: JSON.stringify({ keyId }),
      });
    } catch (err) {
      console.error(err);
    }
  };

  return <Button title={isPending ? "Issuing..." : "Authenticate with Backend"} onPress={handleIssue} disabled={isPending} />;
}