Instagram第三方接入
Instagram第三方接入
簡介
Instagram接入不需要SDK,后臺管理是和facebook一起的,主要是通過網(wǎng)頁接口來實(shí)現(xiàn)相關(guān)登錄,分享等功能
文檔
官方文檔:Instagram 圖譜 API - Instagram 平臺 (facebook.com)
后臺管理:所有應(yīng)用 - Facebook 開發(fā)者
輔助文檔:iOS 使用Instagram授權(quán)登錄 - 簡書 (jianshu.com)
instagram授權(quán)流程(一) - 掘金 (juejin.cn)
(27條消息) Instagram API平臺文檔_AlbertYang的博客-CSDN博客
(27條消息) instagram授權(quán)流程(第二篇)_Android_Study_OK的博客-CSDN博客丞
流程
1、在后臺管理中,創(chuàng)建應(yīng)用,選擇消費(fèi)者
2、客戶端使用uniwebview做網(wǎng)頁訪問
3、權(quán)限請求
請求的URI:
https://api.instagram.com/oauth/authorize?client_id={0}&scope=user_profile&redirect_uri={1}&response_type=code4、重定向
需要在重定向地址接收,這里我用的uniwebview,所以我直接解析返回的URI,獲取到我所需要的數(shù)據(jù)。
5、用戶申請
https://api.instagram.com/oauth/access_token使用的POST請求,參數(shù)如下:
Dictionary<string, string> dic = new Dictionary<string, string>(); dic.Add("client_id", INSTAGRAM_ID.ToString()); dic.Add("client_secret", INSTAGRAM_SECRET); dic.Add("code", _authCode); //從重定向的uri返回的數(shù)據(jù)中獲取 dic.Add("redirect_uri", REDIRECT_URI); dic.Add("grant_type", "authorization_code");6、獲取用戶信息
/// <summary> /// 獲取用戶信息 /// </summary> public const string USER_URI = "https://graph.instagram.com/me";/// <summary> /// 獲取用戶媒體信息 /// </summary> public const string USER_MEDIA_URI = "https://graph.instagram.com/me/media";參數(shù)
?fields=id,username&access_token=access_token從上一步返回的數(shù)據(jù)中獲取。
注意事項(xiàng)
1、如果不適用uniwebview,則需要在你的redirect_uri中,接收instagram返回的數(shù)據(jù),并根據(jù)實(shí)際需求,將相應(yīng)的參數(shù)發(fā)送給app或者網(wǎng)頁等。
尾語
寫的不是很清楚,如果大家有不懂的地方或者寫的有不對的地方,歡迎大家留言。
總結(jié)
以上是生活随笔為你收集整理的Instagram第三方接入的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: X99-DELUXE II 无线网卡li
- 下一篇: PS4计算机模块试题,越玩越留恋的PS4