Instagram Basic display Api(无法获取用户访问令牌 iOS Swift)



我希望我的iOS应用程序的用户通过Instagram登录。 由于Instagram停止了以前的方法,我正在使用Instagram Basic Display API。 可以使用此 API 进行身份验证吗? 其次,我在Facebook开发人员网站上创建了一个应用程序,并设置了Instagram应用程序,并获得了Instagram应用程序ID。 现在如何使用此应用 ID 获取用户访问令牌?

https://api.instagram.com/oauth/authorize
?client_id={instagram-app-id}
&redirect_uri={redirect-uri}
&scope={scope}
&response_type=code
&state={state}        //Optional

我正在使用应用程序ID和重定向uri在邮递员和浏览器中访问此URL。它不起作用并显示错误。

尝试使用 webVieW 加载

override func viewDidLoad() {
super.viewDidLoad()
let url = URL(string: "https://api.instagram.com/oauth/authorize?client_id=(clientId)&redirect_uri=(redirectUri)&scope=user_profile,user_media&response_type=code")
let urlRequest = URLRequest(url: url!)
webView.load(urlRequest)
}

最新更新