Skip to main content
This is the fastest path from an empty project to a signed NEAR transaction. You’ll install a NEAR Auth SDK, wire up the Auth0 provider on mainnet, log a user in, read their derived public key, and request a signature for a simple transfer. Mainnet requires approved credentials, so apply for access to get your Auth0 client id before shipping.
Everything on this page uses the Auth0 login path on mainnet. Use the Auth0 client id you receive after applying, the NEAR Auth contract lives at fast-auth.near, and the MPC signer is v1.signer.
Building locally? You can develop against testnet using the values in Resources → Testnet.
Pick your stack and follow the steps.

Install the SDK and provider

Add the React SDK, the JavaScript (Auth0) provider, and near-api-js.
npm install @fast-auth-near/react-sdk @fast-auth-near/javascript-provider near-api-js

Initialize the provider (mainnet)

Create a JavascriptProvider for mainnet with your client id, connect to the mainnet RPC, and wrap your app in FastAuthProvider. The provider fills in the correct Auth0 domain and signing audience for mainnet automatically.
App.tsx
import { FastAuthProvider } from "@fast-auth-near/react-sdk";
import { JavascriptProvider } from "@fast-auth-near/javascript-provider";
import { connect } from "near-api-js";

const provider = new JavascriptProvider({
  network: "mainnet",
  clientId: "<your-auth0-client-id>",
});

const { connection } = await connect({
  networkId: "mainnet",
  nodeUrl: "https://rpc.mainnet.near.org",
});

export default function App() {
  return (
    <FastAuthProvider
      providerConfig={{ provider }}
      connection={connection}
      network="mainnet"
    >
      <YourApp />
    </FastAuthProvider>
  );
}
FastAuthProvider builds a relayer-aware FastAuthClient under the hood, pointed at fast-auth.near and v1.signer. You reach it through the hooks below.

Log the user in

Grab the client with useFastAuth, check status with useIsLoggedIn, and call login() to open the Auth0 flow.
LoginButton.tsx
import { useFastAuth, useIsLoggedIn } from "@fast-auth-near/react-sdk";

function LoginButton() {
  const { client } = useFastAuth();
  const { isLoggedIn } = useIsLoggedIn();

  if (isLoggedIn) return <span>You're signed in 🎉</span>;
  return <button onClick={() => client?.login()}>Sign in</button>;
}

Get a signer and read the public key

Once the user is authenticated, obtain a signer and read the NEAR public key derived for their identity. The usePublicKey hook returns the key directly, or you can pull a signer yourself with useSigner.
AccountInfo.tsx
import { useSigner, usePublicKey } from "@fast-auth-near/react-sdk";

function AccountInfo() {
  const { signer } = useSigner();
  const { publicKey } = usePublicKey();

  return <code>{publicKey?.toString()}</code>;
}
The derived key is deterministic — the same Auth0 login always controls the same NEAR key. getPublicKey() returns an Ed25519 key by default; pass "secp256k1" if you need that curve.

Request a signature and complete the flow

Build a transfer, request the signature (this triggers an Auth0 approval), then let the relayer-backed signer submit it. In the React SDK the signer exposes signAndSendTransaction, which requests the signature, calls the NEAR Auth contract, and broadcasts the result for you.
Transfer.tsx
import { transactions } from "near-api-js";
import { useSigner, usePublicKey } from "@fast-auth-near/react-sdk";

function Transfer({ senderId, nonce, blockHash }) {
  const { signer } = useSigner();
  const { publicKey } = usePublicKey();

  async function transfer() {
    const transaction = transactions.createTransaction(
      senderId,                 // sender account id
      publicKey,                // sender's derived public key
      "receiver.near",          // receiver
      nonce,                    // account nonce
      [transactions.transfer(BigInt("1000000000000000000000000"))], // 1 NEAR
      blockHash,                // recent block hash
    );

    // Requests the Auth0 signature, submits to fast-auth.near,
    // and broadcasts via the relayer.
    const result = await signer.signAndSendTransaction({ transaction });
    console.log(result.transaction.hash);
  }

  return <button onClick={transfer}>Send 1 NEAR</button>;
}
Requesting a signature performs an Auth0 context switch — a popup or a full-page redirect, depending on how you configure the provider. Design your UX to expect it: persist any in-flight state before the call, and handle the return so users land back where they started. On redirect, the signature is retrieved on the callback page.

Next steps

You’ve completed the full loop — login, key derivation, signature, and submission. Go deeper on each part, then take it live.

Authenticate your users

Login, logout, session checks, and handling the Auth0 popup vs. redirect flows.

Sign transactions

The full signature round-trip, delegate actions, and gasless relayer submission.

Go to production

Apply for approved mainnet credentials to launch your app on fast-auth.near.