Sign Call: React Native
# support
m
Can I somehow "sign" a call? Can't find such a concept in the docs. Like I have a user, and they can only use the Call function only if they have Premium. So I "presign" the call with some token, and user can initiate the call. Is there anything like that?
a
Hi Miteg, In the context of Vapi, you can use JWT (JSON Web Token) authentication to control and restrict access to API features, such as initiating a call, based on user permissions like a Premium status. Here's how you can implement this: 1. **Generate a JWT Token**: Create a token that includes user-specific information and any permissions needed, like indicating a Premium status. 2. **Define the Payload**:
Copy code
javascript
   const payload = {
     orgId: process.env.ORG_ID,
     token: {
       tag: "private",
       permissions: {
         premiumAccess: true
       }
     }
   };
3. **Sign the Token**: Use your private key to sign the token securely. 4. **Use the Token in Calls**: Before users initiate a call, ensure they provide this token. You can integrate the token validation in your backend to verify if the user has the necessary permissions to proceed with the call. For more details on JWT Authentication and API usage, refer to the [JWT Authentication Guide](https://docs.vapi.ai/customization/jwt-authentication). This approach allows you to "pre-sign" calls with tokens, governing access based on user attributes.