Closed gabrielcipriano closed 1 month ago
A proposal for signed endpoints, so we have "authentication" at request level
import { useCommune } from "@commune-ts/providers/use-commune"; import { signData, createSessionData} from "@commune-ts/api"; const { signHex } = useCommune(); const useStartSession = api.auth.startSession.useMutation(); const handleStartSession = async () => { const sessionData = createSessionData(window); const signedData = signData(signHex, sessionData); const result = await useStartSession.mutateAsync(signedData); console.log("token: ", result.token); console.log("authenticationType: ", result.authenticationType); // Bearer const authorization = `${result.authenticationType} ${result.token}`; // "Bearer <token>" // Set the token as authorization header // ... }
8558673
View logs
This will be closed since front end integration PR has all the contents of this branch
A proposal for signed endpoints, so we have "authentication" at request level
using it on client side example: