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

Network Error / unsupported protocol on 302 redirect with custom scheme #5569

Open
sebastienlabine opened this issue Feb 24, 2023 · 1 comment

Comments

@sebastienlabine
Copy link

Describe the bug

Axios request fails on a 302 status code when a custom scheme / protocol is in the location header.

On react-native, it gives a NETWORK_ERROR instead of a unsupported protocol.

This is related to #4901.

To Reproduce

Call an endpoint with axios that returns a 302 with a Location header that is not a supported protocol by axios, like smartbills://

Code snippet

var axios = require("axios")


axios.get("https://axios.free.beeceptor.com/scheme", {maxRedirect:0}).then(() => console.log("success")).catch((error) => {
console.error(error.request)
throw error;
});

Expected behavior

I don't except the client to crash because the server response is valid. I should be able to handle the redirect as I wish.

As we use it for OAuth2, any client can pass their own app scheme, so we need to be able to detect it and redirect the user to the client app.

Axios Version

1.3.4

Adapter Version

No response

Browser

No response

Browser Version

No response

Node.js Version

No response

OS

No response

Additional Library Versions

React native 0.71

Additional context/Screenshots

No response

@davux
Copy link

davux commented Jul 16, 2024

Same problem here. Still happening on axios 1.7.2 on React Native.

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

No branches or pull requests

4 participants