Open katafractari opened 3 years ago
@katafractari this package is intended to be used with Twilio Functions - Twilio
is a global variable available in the Twilio Functions runtime environment.
Are you trying to use this within your Typescript server app?
I'm changing the tag as this is not a bug per se but rather a new feature.
@ktalebian Yes, I'm trying to use the validator(token: string, accountSid: string, authToken: string): Promise<object>
within a Node/Typescript server project. I tagged this ticket as a bug because the README.md states that this package can be used in an existing Node application.
I need to validate Twilio Flex JWT in my API project because that's how we authenticate requests coming from our Twilio Flex Plugin. My current workaround is to declare the Twilio namescape in my custom typings.d.ts file.
@katafractari sorry about the delay; I made this PR https://github.com/twilio/twilio-flex-token-validator/pull/27/files to address the problem
@katafractari would you mind giving v1.5.5 a try and see if that fixes your problem?
@ktalebian I bumped the version to 1.5.5 and removed Twilio namespace declaration from my typings.d.ts, which did not produces any errors. Thanks for the fix!
Description
I have a Typescript project (NestJS) in which in want to use twilio-flex-token-validator. I get a compile time error Cannot find namespace 'Twilio' after I import it in the project.
Versions
twilio-flex-token-validator
1.5.4
node
15.0.1
npm
7.0.3
typescript
3.7.4
Steps to Reproduce
npm i -S twilio-flex-token-validator
import * as twilio from 'twilio'
9 export declare type Callback = (error: any, response: Twilio.Response) => void;