ory / ory/sdk

[JS/TS SDK] inconsistent FrontendApi.createBrowserSettingsFlow

Open
#439 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
PHP
Stars
178
Forks
96
Avg merge
6d 23h
Merged PRs (30d)
3

Description

Preflight checklist
Ory Network Project

No response

Describe the bug

When using the JS/TS SDK client @ory/client, behavior of createBrowserLogoutFlow and createBrowserSettingsFlow are inconsistent.

While calling createBrowserLogoutFlow without any args, the returned type is JSON, from which it is easy to extract logout_url.
When calling createBrowserSettingsFlow without any args, the API response is a 302 to the settings page, which is not handled correctly by the client leading to an exception. One must provide { headers: { accept: "application/json" } } for the code to complete successfully.

Reproducing the bug
const ory: FrontendApi = new FrontendApi(
	new Configuration({
		basePath: AUTH_ENDPOINT,
		credentials: "include",
	}),
);

const { logout_url } = await ory.createBrowserLogoutFlow();
const { request_url } = await ory.createBrowserSettingsFlow(); // => exception, invalid JSON
Relevant log output

Relevant configuration

Version

1.20.22

On which operating system are you observing this issue?

None

In which environment are you deploying?

None

Additional Context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated JS/TS FrontendApi entry points createBrowserLogoutFlow and createBrowserSettingsFlow, then reproduce both calls from the issue's TypeScript example. Compare their response handling, and consider the issue done when createBrowserSettingsFlow without arguments completes consistently instead of failing on invalid JSON.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.