diff --git a/src/state/usePasscodeAuth/usePasscodeAuth.ts b/src/state/usePasscodeAuth/usePasscodeAuth.ts index 12c1dcf40..acc34f3e7 100644 --- a/src/state/usePasscodeAuth/usePasscodeAuth.ts +++ b/src/state/usePasscodeAuth/usePasscodeAuth.ts @@ -1,6 +1,8 @@ import { useCallback, useEffect, useState } from 'react'; import { useHistory } from 'react-router-dom'; +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'); @@ -14,7 +16,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',