From 5325add1944dd89b2f53c3c687ed81667105167b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arturo=20D=C3=ADaz=20Rosemberg?= Date: Wed, 7 Apr 2021 18:33:28 -0500 Subject: [PATCH] fix usage of REACT_APP_TOKEN_ENDPOINT if passcode authentication is being used the flag REACT_APP_TOKEN_ENDPOINT currently was being ignored. --- src/state/usePasscodeAuth/usePasscodeAuth.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/state/usePasscodeAuth/usePasscodeAuth.ts b/src/state/usePasscodeAuth/usePasscodeAuth.ts index 198934ca7..4a2ac339e 100644 --- a/src/state/usePasscodeAuth/usePasscodeAuth.ts +++ b/src/state/usePasscodeAuth/usePasscodeAuth.ts @@ -2,6 +2,8 @@ import { useCallback, useEffect, useState } from 'react'; import { useHistory } from 'react-router-dom'; import { RoomType } from '../../types'; +const endpoint = process.env.REACT_APP_TOKEN_ENDPOINT || '/token'; + export function getPasscode() { const match = window.location.search.match(/passcode=(.*)&?/); const passcode = match ? match[1] : window.sessionStorage.getItem('passcode'); @@ -15,7 +17,7 @@ export function fetchToken( create_room = true, create_conversation = process.env.REACT_APP_DISABLE_TWILIO_CONVERSATIONS !== 'true' ) { - return fetch(`/token`, { + return fetch(endpoint, { method: 'POST', headers: { 'content-type': 'application/json',