Skip to content

Commit ed81854

Browse files
author
Abimbola Idowu
committed
refactor(buildRequest): ensure projectKey is present
affects: @commercetools/sdk-middleware-auth
1 parent 0fea194 commit ed81854

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/sdk-middleware-auth/src/build-requests.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,13 @@ export function buildRequestForRefreshTokenFlow () {
9494
}
9595

9696
export function buildRequestForAnonymousSessionFlow (
97-
options: AuthMiddlewareOptions = {},
97+
options: AuthMiddlewareOptions,
9898
): BuiltRequestParams {
99+
if (!options)
100+
throw new Error('Missing required options')
101+
102+
if (!options.projectKey)
103+
throw new Error('Missing required option (projectKey)')
99104
const pKey = options.projectKey
100105
// eslint-disable-next-line no-param-reassign
101106
options.oauthUri = options.oauthUri || `/oauth/${pKey}/anonymous/token`

0 commit comments

Comments
 (0)