score:3

Accepted answer
import queryString from 'query-string';

queryString.parse(props.location.hash)

// { access_token: '...', token_type: '...' }

score:1

const getJsonFromUrl = str => {
  const query = str.substr(1);
  const result = {};

  query.split('&').forEach(function(part) {
    const item = part.split('=');
    result[item[0]] = decodeURIComponent(item[1]);
  });

  return result;
};

const { access_token, token_type } = getJsonFromUrl(props.location.hash);

score:1

let params = new URLSearchParams(window.location.hash);
let token = params.get('access_token');

Related Query

More Query from same tag