chore: use correct env var in fetch service token function
This commit is contained in:
@@ -6,21 +6,25 @@ const SERVICE_TOKEN_REVALIDATE_SECONDS = 3599 // 59 minutes and 59 seconds.
|
|||||||
|
|
||||||
async function fetchServiceToken(): Promise<ServiceTokenResponse> {
|
async function fetchServiceToken(): Promise<ServiceTokenResponse> {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`${env.CURITY_ISSUER_USER}/oauth/v2/token`, {
|
const response = await fetch(
|
||||||
method: "POST",
|
`${env.CURITY_ISSUER_SERVICE}/oauth/v2/token`,
|
||||||
headers: {
|
{
|
||||||
"Content-Type": "application/x-www-form-urlencoded",
|
method: "POST",
|
||||||
Accept: "application/json",
|
headers: {
|
||||||
},
|
"Content-Type": "application/x-www-form-urlencoded",
|
||||||
body: new URLSearchParams({
|
Accept: "application/json",
|
||||||
grant_type: "client_credentials",
|
},
|
||||||
client_id: env.CURITY_CLIENT_ID_SERVICE,
|
body: new URLSearchParams({
|
||||||
client_secret: env.CURITY_CLIENT_SECRET_SERVICE,
|
grant_type: "client_credentials",
|
||||||
}),
|
client_id: env.CURITY_CLIENT_ID_SERVICE,
|
||||||
next: {
|
client_secret: env.CURITY_CLIENT_SECRET_SERVICE,
|
||||||
revalidate: SERVICE_TOKEN_REVALIDATE_SECONDS,
|
scope: "hotel",
|
||||||
},
|
}),
|
||||||
})
|
next: {
|
||||||
|
revalidate: SERVICE_TOKEN_REVALIDATE_SECONDS,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error("Failed to obtain service token")
|
throw new Error("Failed to obtain service token")
|
||||||
|
|||||||
Reference in New Issue
Block a user