|
6 | 6 | import axios, { AxiosInstance } from 'axios'; |
7 | 7 | import https from 'https'; |
8 | 8 | import { SignJWT, jwtVerify } from 'jose'; |
9 | | -import { URL, URLSearchParams } from 'url'; |
10 | 9 | import * as constants from './constants'; |
11 | 10 | import { DuoException } from './duo-exception'; |
12 | 11 | import { |
@@ -89,9 +88,8 @@ export class Client { |
89 | 88 | throw new DuoException(constants.INVALID_CLIENT_SECRET_ERROR); |
90 | 89 |
|
91 | 90 | if (apiHost === '') throw new DuoException(constants.PARSING_CONFIG_ERROR); |
92 | | - |
93 | 91 | try { |
94 | | - new URL(redirectUrl); |
| 92 | + new globalThis.URL(redirectUrl); |
95 | 93 | } catch { |
96 | 94 | throw new DuoException(constants.PARSING_CONFIG_ERROR); |
97 | 95 | } |
@@ -214,7 +212,7 @@ export class Client { |
214 | 212 | try { |
215 | 213 | const { data } = await this.axios.post<HealthCheckResponse>( |
216 | 214 | this.HEALTH_CHECK_ENDPOINT, |
217 | | - new URLSearchParams(request), |
| 215 | + new globalThis.URLSearchParams(request), |
218 | 216 | ); |
219 | 217 | const { stat } = data; |
220 | 218 |
|
@@ -271,7 +269,7 @@ export class Client { |
271 | 269 | scope: 'openid', |
272 | 270 | }; |
273 | 271 |
|
274 | | - return `${this.baseURL}${this.AUTHORIZE_ENDPOINT}?${new URLSearchParams(query).toString()}`; |
| 272 | + return `${this.baseURL}${this.AUTHORIZE_ENDPOINT}?${new globalThis.URLSearchParams(query).toString()}`; |
275 | 273 | } |
276 | 274 |
|
277 | 275 | /** |
@@ -307,7 +305,7 @@ export class Client { |
307 | 305 | try { |
308 | 306 | const { data } = await this.axios.post<TokenResponse>( |
309 | 307 | this.TOKEN_ENDPOINT, |
310 | | - new URLSearchParams(request), |
| 308 | + new globalThis.URLSearchParams(request), |
311 | 309 | { |
312 | 310 | headers: { |
313 | 311 | 'user-agent': `${constants.USER_AGENT} node/${process.versions.node} v8/${process.versions.v8}`, |
|
0 commit comments