import twilio's Authy library in nest js

247 Views Asked by At

we usually use below statement to use authy library in node file using js ,mostly by require statement !

const authy = require('authy')('API KEY');

I've moved my code to nest eco system and now How should i do the same using typescript ,as i also want to pass API Key to it ? I've tried below code as well ,but still it's not working

import { authy } from 'authy'(API KEY)

suggest something !

1

There are 1 best solutions below

2
Ayush Somani On

I have faced a similar issue in my NestJS project when using twillio library.

Currently, I have resolved this by importing it this way:

import authy = require('authy');

If, this doesn't work for you (for any reason e.g. TypeScript compile error), then can you try the following import statement?

import * as Authy from 'authy';

Also, let me know which one works for you.