0
votes

I have a simple like this in one of my component:

  componentDidMount() {
    axios
      .get(
        API_URL +
          "oauth2/authorize?client_id=" +
          API_CLIENT_ID +
          "&response_type=token"
      )
      .then(function (response) {
        console.log(response);
      })
      .catch(function (error) {
        // handle error
        console.log(error);
      })
      .then(function () {
        // always executed
      });
  }

however, i would like to parse the callback url which is from imgur Oauth2 app:

https://example.com/oauthcallback#access_token=ACCESS_TOKEN&token_type=Bearer&expires_in=3600

but cant seem to access it, i could only see response.status which is 200, response.header, ect.. how to get the url ?

2

2 Answers

0
votes

Response Schema of axios request

{
  // `data` is the response that was provided by the server
  data: {},
}

try this

response.data.url
0
votes

You can parse your request's response url like this:

response.request.responseURL