Skip to content

[OAuth2] return 401 instead of 302 on xhr requests #30102

@AurelienBegou

Description

@AurelienBegou

Title: [OAuth2] return 401 instead of 302 on xhr requests

Description:
In the context of Single Page Application (SPA) the code is stored in cache in the browser and at the end of the session having a 302 redirect will cause issue in the design. Typically when xhr request is detected it should return 401 instead.

Is it such configuration possible ? I try to search on the documentation but was not able to found it.

[optional Relevant Links:]
Example on another auth-proxy
Oauth2-Proxy: https://oauth2-proxy.github.io/oauth2-proxy/docs/behaviour/
Specific line:
"If authentication is required but missing then the user is asked to log in and redirected to the authentication provider (unless it is an Ajax request, i.e. one with Accept: application/json, in which case 401 Unauthorized is returned)"

Thanks for the help

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions