Ошибка обещания при попытке получить API Instagram с помощьюactjs - PullRequest
0 голосов
/ 21 ноября 2018

Не удалось загрузить ресурс: сервер ответил с состоянием 400 () index.js: 65 Uncaught (в обещании) Ошибка в handleErrors (index.js: 65) home: 1 Не удалось загрузить https://api.instagram.com/oauth/authorize/?client_id=28cd69add25e4204acc8d8ed392d7683&redirect_uri=http://localhost:3000/home&response_type=json&scope=public_content: Ответ на предпечатную проверку недействителен (перенаправление)

import React, { Component } from 'react';
import SearchBar from './search_bar';
//import ProfileList from './profilelist'
//import { user} from 'fetch-instagram';
import ig from 'fetch-instagram';

const instagram = ig({
  accessToken: '***********************',
  resirectUri:"http://localhost:3000/home",
});
const users = instagram.user();

users.then(res => console.log(res));

class InstaApp extends Component {
  constructor(props){
    super(props);

    this.state = { 
        profiles: []
    };

}
componentDidMount(){
  this.profileSearch();
}

profileSearch(searchTerm) {
  fetch("https://api.instagram.com/oauth/authorize/?client_id=acess_token&redirect_uri=http://localhost:3000/home&response_type=json&scope=public_content", {
      headers: {
        'Content-Type': 'application/json',
        'Accept': 'application/json'
      }
    })
    .then(response => {
      return response.json();
    }).then(result => {
      console.log(result);
      this.setState({
        user: result.user,

      });
    });
}


  render() {

    return (
      <div>
        <SearchBar onSearchTermChange={searchTerm => this.profileSearch(searchTerm)}/>
        {/* <ProfileList 
          onProfileSelect={userSelected => this.setState({selectedProfile: userSelected})}
          profile={this.state.profiles} /> */}
      </div>
    );
  }
}

export default InstaApp;

home: 1 Uncaught (в обещании) TypeError: Не удалось получить

...