嗨,我正在练习使用 instagrams api,并尝试查看是否可以发布一个 github 页面网站,其中包含我帐户中的 instagram 帖子库。在本地运行时,它运行良好,但一旦将其推送到 github/已部署,当我检查我的 facebook 开发人员帐户时,令牌将被删除。有人知道怎么修这个东西吗?提前致谢!
做过的事情:
app.get('/insta', (req, res) => {
axios.get(`https://graph.instagram.com/me/media?fields=id,media_type,media_url,caption&limit=12&access_token=${process.env.REACT_APP_INS_TOKEN}`)
.then((response) => {
res.json(response.data)
}).catch((error) => {
console.log('error', error)
})
})
如果有帮助,这就是我将前端连接到后端的方式
const [feeds, setFeedsData] = useState([])
useEffect(() => {
const options = {
method: 'GET',
url: 'http://localhost:8000/insta'
}
async function fetchInstagramPost() {
axios
.request(options)
.then((response) => {
// console.log(response.data)
setFeedsData(response.data)
}).catch((error) => {
console.log('error', error)
})
}
fetchInstagramPost();
}, [])