Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
edited title
Link
Glorfindel
  • 6.9k
  • 3
  • 22
  • 49

How to get access_token from the uri after the fetch function excutesexecutes?

added 2 characters in body; edited tags
Source Link
Glorfindel
  • 6.9k
  • 3
  • 22
  • 49

I am using this snippet to authorize to the stack-OverflowStack 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", }); } }

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 iI open the response from the network tab  ,it it takes me to this URI  :

https://stackexchange.com/oauth/login_success#access_token=43w24pKEasZPWEiGljW(5Q))

with Authorizing Application bodywhich shows 'Authorizing Application'.

Can anyone help what's wrong with the flow?

I am using this snippet to authorize to the stack-Overflow 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))

with Authorizing Application body.

Can anyone help what's wrong with the flow?

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?

Source Link

How to get access_token from the uri after the fetch function excutes?

I am using this snippet to authorize to the stack-Overflow 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))

with Authorizing Application body.

Can anyone help what's wrong with the flow?