feat(SW-353): dynamic rewards
This commit is contained in:
@@ -4,7 +4,9 @@ import { ServiceTokenResponse } from "@/types/tokens"
|
||||
|
||||
const SERVICE_TOKEN_REVALIDATE_SECONDS = 3599 // 59 minutes and 59 seconds.
|
||||
|
||||
export async function fetchServiceToken(): Promise<ServiceTokenResponse> {
|
||||
export async function fetchServiceToken(
|
||||
scopes: string[]
|
||||
): Promise<ServiceTokenResponse> {
|
||||
try {
|
||||
const response = await fetch(`${env.CURITY_ISSUER_USER}/oauth/v2/token`, {
|
||||
method: "POST",
|
||||
@@ -16,7 +18,7 @@ export async function fetchServiceToken(): Promise<ServiceTokenResponse> {
|
||||
grant_type: "client_credentials",
|
||||
client_id: env.CURITY_CLIENT_ID_SERVICE,
|
||||
client_secret: env.CURITY_CLIENT_SECRET_SERVICE,
|
||||
scope: ["hotel"].join(","),
|
||||
scope: scopes.join(","),
|
||||
}),
|
||||
next: {
|
||||
revalidate: SERVICE_TOKEN_REVALIDATE_SECONDS,
|
||||
|
||||
Reference in New Issue
Block a user