πWorking with Access Tokens
You've logged your user in, you have their access token, what's next?
Using Access Tokens
1. Include the Access Token in API Requests
import Picket from "@picketapi/picket-js";
const picket = new Picket("YOUR_PUBLISHABLE_KEY_HERE");
// NOTE: This assumes the user is logged in
const { accessToken } = await picket.authState();
await fetch("myapi.com", {
method: "GET",
headers: {
// Use the access token as a bearer auth token
Authorization: `Bearer ${accessToken}`
}
});curl myapi.com -H "Authorization: Bearer ${ACCESS_TOKEN}"2. Validate the Access Token Server-Side
Server-Side SDKs
Node.js Library - picket-nodeGo Library - picket-goPython Library - picket-pythonLast updated