PHP-检索访问令牌-禁用隐式OAuth
我正在使用Instagram Api。 为了检索访问令牌,我使用带有参数“code”的方法。 通过这个代码参数,我可以构建一个url,它将返回访问令牌 例如:PHP-检索访问令牌-禁用隐式OAuth,php,http,instagram,access-token,instagram-api,Php,Http,Instagram,Access Token,Instagram Api,我正在使用Instagram Api。 为了检索访问令牌,我使用带有参数“code”的方法。 通过这个代码参数,我可以构建一个url,它将返回访问令牌 例如: https://instagram.com/oauth/authorize/?client_id=CODE_ID&redirect_uri=my-redirect-url&response_type=code 当我通过网络浏览器访问此URL时,在Instagram重定向后,它将返回到我创建的web服务。然后,存储我的访问
https://instagram.com/oauth/authorize/?client_id=CODE_ID&redirect_uri=my-redirect-url&response_type=code
当我通过网络浏览器访问此URL时,在Instagram重定向后,它将返回到我创建的web服务。然后,存储我的访问令牌
如何在PHP中实现自动化
此示例不起作用:
exec('curl https://instagram.com/oauth/authorize/?client_id=CODE_ID&redirect_uri=my-redirect-url&response_type=code');
我如何处理Instagram的重定向
提前感谢。由于在生成授权码之前需要明确的用户身份验证,因此无法自动执行此操作。因此,您必须使用PHP重定向:
header('Location: https://instagram.com/oauth/authorize/?client_id=CODE_ID&redirect_uri=my-redirect-url&response_type=code');
让用户在Instagram浏览器中进行身份验证,然后获取Instagram发送到重定向uri
的代码