I am using this snippet to authorize to the Stack Exchange API
const baseUrl =
"https://stackexchange.com/oauth/dialog?client_id=17823&scope=read_inbox,no_expiry&redirect_uri=https://stackexchange.com/oauth/login_success";
export default class Authentication {
authorize() {
console.log("calling authorize");
fetch(baseUrl, {
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Access-Control-Allow-Origin": "https://stackexchange.com",
},
mode: "no-cors",
});
}
}
It is not redirecting to the user's approval page. Instead when I open the response from the network tab, it takes me to this URI:
https://stackexchange.com/oauth/login_success#access_token=43w24pKEasZPWEiGljW(5Q))
which shows 'Authorizing Application'.
Can anyone help what's wrong with the flow?