Skip to content

Commit

Permalink
fix: #1010 make response mode optional
Browse files Browse the repository at this point in the history
  • Loading branch information
pamapa committed Nov 15, 2023
1 parent b236525 commit 73fb525
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The API is largely backwards-compatible. The merge claims behavior has been impr
- `refreshTokenCredentials` use `fetchRequestCredentials` since 2.1.0
- the `mergeClaims` has been replaced by `mergeClaimsStrategy`
- if the previous behavior is needed `mergeClaimsStrategy: { array: "merge" }` can be used
- default of `response_mode` changed from `query` → `undefined`


## oidc-client v1.11.5 → oidc-client-ts v2.0.0
Expand Down
14 changes: 10 additions & 4 deletions src/OidcClientSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { InMemoryWebStorage } from "./InMemoryWebStorage";
const DefaultResponseType = "code";
const DefaultScope = "openid";
const DefaultClientAuthentication = "client_secret_post";
const DefaultResponseMode = "query";
const DefaultStaleStateAgeInSeconds = 60 * 15;

/**
Expand Down Expand Up @@ -72,7 +71,14 @@ export interface OidcClientSettings {
/** optional protocol param */
resource?: string | string[];

/** optional protocol param (default: "query") */
/**
* Optional protocol param (default: undefined)
* The response mode the authority server is using is defined by the response_type unless explicitly specified:
* - Response mode for the OAuth 2.0 "code" response type is the "query" encoding
* - Response mode for the OAuth 2.0 "token" response Type is the "fragment" encoding
*
* @see https://openid.net/specs/oauth-v2-multiple-response-types-1_0.html#ResponseModes
*/
response_mode?: "query" | "fragment";

/**
Expand Down Expand Up @@ -163,7 +169,7 @@ export class OidcClientSettingsStore {
public readonly ui_locales: string | undefined;
public readonly acr_values: string | undefined;
public readonly resource: string | string[] | undefined;
public readonly response_mode: "query" | "fragment";
public readonly response_mode: "query" | "fragment" | undefined;

// behavior flags
public readonly filterProtocolClaims: boolean | string[];
Expand Down Expand Up @@ -191,7 +197,7 @@ export class OidcClientSettingsStore {
redirect_uri, post_logout_redirect_uri,
client_authentication = DefaultClientAuthentication,
// optional protocol
prompt, display, max_age, ui_locales, acr_values, resource, response_mode = DefaultResponseMode,
prompt, display, max_age, ui_locales, acr_values, resource, response_mode,
// behavior flags
filterProtocolClaims = true,
loadUserInfo = false,
Expand Down

0 comments on commit 73fb525

Please sign in to comment.