Examples
Make authenticated requests
In your frontend, usesdk.quickAuth.fetch to
make an authenticated request. This will automatically get a Quick Auth session
token if one is not already present and add it as Bearer token in the
Authorization header:
Use a session token directly
In your frontend, usesdk.quickAuth.getToken to get a Quick Auth
session token. If there is already a session token in memory that hasn’t
expired it will be immediately returned, otherwise a fresh one will be
acquired.
Validate a session token
First, install the Quick Auth library into your backend with:verifyJwt to check the JWT and get back the token payload
which has the FID of the user as the sub property.
You can then look up additional information about the user.
Optimizing performance
To optimize performance, provide apreconnect hint to the browser in your
frontend so that it can preemptively initiate a connection with the Quick Auth
Server:
Quick Auth vs Sign In with Farcaster
Sign In with Farcaster is the foundational standard that allows Farcaster users to authenticate into applications. Farcaster Quick Server is an optional service built on top of SIWF that is highly performant and easy to integrate. Developers don’t need to worry about securely generating and consuming nonces or the nuances of verifying a SIWF message—instead they receive a signed JWT that can be used as a session token to authenticate their server. The Auth Server offers exceptional performance in two ways:- the service is deployed on the edge so nonce generation and verification happens close to your users no matter where they are located
- the issued tokens are asymmetrically signed so they can be verified locally on your server
Functions
Properties
| Name | Description |
|---|---|
| token | Returns an active token if present |

