I was using a Dribbble api v1 and it was successfully in feching data. Then it stoped to return because the v1 become deprecated. Later I made a new app version using the v2 api and I got a new 'access_token' and it continuing not showing.
Overview for the v2 Dribble API https://developer.dribbble.com/v2/
When I put this URL in the browser:
https://api.dribbble.com/v2/user?access_token=1323213h23h2131j2h3jk12
it returns succefully my personal data from my account. It proves that my tolken is working.
But in my App I want to return popular shots from all users and it doesn' return nothing:
NOTE: This code was been working when I was using v1 Dribbble api. I made this using ReactJS but the Knowledge of this tool is not mandatory to understand the problem. It is something wrong that have to do with v2 Dribbble api.
export default class DribbblesList extends Component {
constructor(props) {
super(props);
this.state = { page: 1, shots: [], showModal: false };
this.getShots = this.getShots.bind(this);
}
componentDidMount() {
this.getShots();
}
getShots() {
this.setState({
dataFetched: false
})
return $.getJSON('https://api.dribbble.com/v2/shots?page=' +
this.state.page + '&access_token=sdfsdfsdfsdfsdfsdfsdf')
.then((resp) => {
var newShots = this.state.shots.concat(resp.data);
this.setState({
page: this.state.page + 1,
shots: newShots,
dataFetched: true
});
console.log(resp)
});
}
render() {
const shots = this.state.shots.map((data, i) => {
return (
<div>
<Dribbble data={data} key={i} />
</div>
)
});
Error Message: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 404.
Does anybody know how to solve it? Thank you