I am trying to fetch user information from instagram but now instagram sending request to the user to allow me to fetch their information and then only I can get their data
Will there be any way to make this process App to App communication without user concern
GET AUTH CODE
app.get("/get-auth-code", (req, res, next) => {
console.log(INSTA_REDIRECT_URI);
return res.send(
`<a href='https://api.instagram.com/oauth/authorize? client_id=${INSTA_APP_ID}&redirect_uri=${INSTA_REDIRECT_URI}&scope=user_media,user_profile&response_type=code'> Connect to Instagram </a>`
);
});
To Get Access Token From Instagram API
app.get("/getAccessToken",asyncHandler((req, res, next) => {
request.post(
{
url: "https://api.instagram.com/oauth/access_token",
form: {
redirect_uri: INSTA_REDIRECT_URI,
client_id: INSTA_APP_ID,
client_secret: INSTA_APP_SECRET,
code: INSTA_AUTH_CODE,
grant_type: "authorization_code",
},
},
function (err, httpResponse, body) {
/* ... */
console.log("err: " + err);
console.log("body: " + body);
return res.status(200).json(body);
}
);
})
);
To Get User Details from Instagram API
app.get("/getDetail",asyncHandler((req, res, next) => {
request.get(
{
url: `https://graph.instagram.com/${INSTA_USER_ID}?
fields=id,username,media_type&access_token=${INSTA_ACCESS_TOKEN}`,
},
function (err, httpResponse, body) {
/* ... */
console.log("err: " + err);
console.log("body: " + body);
return res.status(200).json(body);
}
);
})
);
So the point is to get users information without getting permission from the user , Is there any way to do this