Drop-in components and infrastructure to add authorization at every layer of the tech stack, from front-end to back-end.
1//2// App.jsx3//4<WarrantProvider clientKey="<your_client_key>">5 {/* Routes, ThemeProviders, etc. */}6</WarrantProvider>;7
8//9// MyComponent.jsx10//11<ProtectedComponent12 warrants={[{13 objectType: "myObject",14 objectId: object.id,15 relation: "viewer",16 }]}17>18 <MyComponent/>19</ProtectedComponent>20
1import "github.com/warrant-dev/warrant-go"2
3client := warrant.NewClient(warrant.ClientConfig{4 ApiKey: "<your_api_key>",5})6
7isAuthorized, err := client.IsAuthorized(warrant.Warrant{8 ObjectType: "report",9 ObjectId: "profits-and-losses",10 Relation: "viewer",11 Subject: warrant.Subject{12 ObjectType: "user",13 ObjectId: "user.id",14 },15})16
17if isAuthorized {18 // Carry out authorized logic19}20