We are developing PHP using the Instagram API in our local environment.When authenticating the application for access token acquisition, if you skip the URL to Instagram from the login screen, the following error will appear.
The authentication screen should be up, but the wrong part cannot be considered and the reference for solving the error cannot be found.
Can someone give me some advice?Thank you for your cooperation.
Error:
{
"code"—400,
"error_type": "OAuthException",
"error_message": "You must include a valid client_id, response_type, and redirect_uri parameters"
}
URL returned by browser:
session_start();
if(empty($_GET['code']))}
// Pre-Authentication Preparation
$params=array(
'client_id' = > CLIENT_ID,
'&redirect_uri' = > SITE_URL. 'htdocs/redirect.php',
'&scope' = > 'basic + comments + relationships + likes',
'&response_type' = > 'code'
);
$url='https://api.instagram.com/oauth/authorize/?'.http_build_query($params);
// post on Instagram
header('Location:'.$url);
exit;
How about the following?
//Pre-authentication Preparation
$params=array(
'client_id' = > CLIENT_ID,
'redirect_uri' = > urlencode (SITE_URL.'htdocs/redirect.php'),
'scope' = > 'basic comments relationships likes',
'response_type' = > 'code'
);
$url='https://api.instagram.com/oauth/authorize/?'.http_build_query($params);
// post on Instagram
header('Location:'.$url);
exit;
I think the array I gave to http_build_query was automatically added without using & or +.
617 Uncaught (inpromise) Error on Electron: An object could not be cloned
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
581 PHP ssh2_scp_send fails to send files as intended
912 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.