Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: type ErrorBrowserLocationChangeRequired #3397

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jossbnd
Copy link
Contributor

@jossbnd jossbnd commented Jul 26, 2023

Related issue(s)

ory/sdk#277

Type of 'error' should be GenericError instead of ErrorGeneric

Error *ErrorGeneric `json:"error,omitempty"`

Checklist

  • I have read the contributing guidelines.
  • I have referenced an issue containing the design document if my change
    introduces a new feature.
  • I am following the
    contributing code guidelines.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security vulnerability, I
    confirm that I got the approval (please contact
    security@ory.sh) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added or changed the documentation.

Further Comments

@jossbnd jossbnd changed the title fix: ErrorBrowserLocationChangeRequired type fix: type ErrorBrowserLocationChangeRequired Jul 26, 2023
@codecov
Copy link

codecov bot commented Jul 26, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (21ab031) 78.33% compared to head (21ab031) 78.33%.

❗ Current head 21ab031 differs from pull request most recent head b637900. Consider uploading reports for the commit b637900 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3397   +/-   ##
=======================================
  Coverage   78.33%   78.33%           
=======================================
  Files         346      346           
  Lines       23551    23551           
=======================================
  Hits        18448    18448           
  Misses       3710     3710           
  Partials     1393     1393           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aeneasr aeneasr requested review from jonas-jonas and removed request for zepatrik July 26, 2023 16:15
Copy link
Member

@aeneasr aeneasr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is correct - genericError is a legacy type. What issues are you observing?

@jossbnd
Copy link
Contributor Author

jossbnd commented Aug 18, 2023

I believe this is correct - genericError is a legacy type. What issues are you observing?

not properly an issue, just that the error looks like this:
{ error: { error: { ... } }, redirect_browser_to: string } }

instead of the other errors:

{ error: { ... }, redirect_browser_to: string } }

meaning I cannot handle it like the others

@jossbnd jossbnd closed this Aug 18, 2023
@jossbnd jossbnd deleted the joss/fix-ErrorBrowserLocationChangeRequired-type branch August 18, 2023 06:56
@jossbnd jossbnd restored the joss/fix-ErrorBrowserLocationChangeRequired-type branch August 18, 2023 06:56
@jossbnd jossbnd reopened this Aug 18, 2023
@jossbnd jossbnd requested a review from hperl as a code owner August 18, 2023 06:56
@aeneasr
Copy link
Member

aeneasr commented Aug 22, 2023

Could you please share the full error and the API you used to get it?

@jossbnd
Copy link
Contributor Author

jossbnd commented Nov 24, 2023

Could you please share the full error and the API you used to get it?

I use the @ory/kratos-client v0.13.1.

Actually, don't know how to trigger this error ErrorBrowserLocationChangeRequired, if you tell me I can try.

But I can just say the structure is not equivalent to other errors as described above. Meaning we need specific code to handle it.

@jossbnd
Copy link
Contributor Author

jossbnd commented Jan 10, 2024

Could you please share the full error and the API you used to get it?

I trigger the error by submitting a login flow with social login and a header Accept set to application/json.
As below:

curl 'https://auth.my-domain.com/kratos/self-service/login?flow=<flow_id>' \
  -H 'authority: auth.my-domain.com' \
  -H 'accept: application/json' \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'origin: null' \
  --data-raw 'provider=google' \
  --compressed

The error looks ok but the structure doesn't fit the Model.

Actual response:

{
    redirect_browser_to: 'https://accounts.google.com/o/oauth2/v2/auth',
    error: {
      id: 'browser_location_change_required',
      code: 422,
      status: 'Unprocessable Entity',
      reason:'In order to complete this flow please redirect the browser to: https://accounts.google.com/o/oauth2/v2/auth',
      message: 'browser location change required',
    },
}

Model - https://www.ory.sh/docs/kratos/reference/api#tag/frontend/operation/updateLoginFlow :

{
  "redirect_browser_to": "string",
  "error": {
    "error": {
      "id": "string",
      "code": 422,
      "status": "string"
      "reason": "string",
      "message": "string",
    }
  },
}

@brahmlower
Copy link
Contributor

Is there anything blocking this PR being merged? It would be great to have this fixed in the next kratos release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants