diff --git a/package.json b/package.json index 6027db5..aa712ac 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@storyblok/app-extension-auth", "description": "A typed JavaScript library for handling authentication with Storyblok apps.", - "version": "1.0.2", + "version": "1.0.3", "author": { "name": "Johannes Lindgren", "email": "johannes.lindgren@storyblok.com" diff --git a/src/storyblok-auth-api/handle-requests/openidClient.ts b/src/storyblok-auth-api/handle-requests/openidClient.ts index c638a55..c558fed 100644 --- a/src/storyblok-auth-api/handle-requests/openidClient.ts +++ b/src/storyblok-auth-api/handle-requests/openidClient.ts @@ -1,4 +1,4 @@ -import { BaseClient, Issuer } from 'openid-client' +import { BaseClient, Issuer, custom } from 'openid-client' import { redirectUri } from './redirectUri' import { AuthHandlerParams } from '../AuthHandlerParams' import { getRegionUrl, Region } from '@storyblok/region-helper' @@ -26,11 +26,19 @@ export const openidClient: CreateOpenIdClient = (params, region) => { ? `${getRegionUrl(region)}/oauth/user_info` : undefined, }) - return new Client({ + + const client = new Client({ token_endpoint_auth_method: 'client_secret_post', client_id: clientId, client_secret: clientSecret, redirect_uris: [redirectUri(params)], response_types: ['code'], }) + + // eslint-disable-next-line functional/immutable-data + client[custom.http_options] = () => { + return { timeout: 10000 } + } + + return client }