Instagram third-party access
Introduction
Instagram access does not require an SDK, and the background management is with Facebook, mainly through the web interface to achieve related login, sharing and other functions
document
Official Documentation: Instagram Graph API - Instagram Platform (facebook.com)
Admin: All Apps - Facebook Developers
Auxiliary document: iOS uses Instagram to authorize login- Jianshu (jianshu.com)
instagram authorization process (1) - Nuggets (juejin.cn)
(27 messages) Instagram API platform documentation_AlbertYang's blog-CSDN blog
(27 messages) ) instagram authorization process (Part 2)_Android_Study_OK's Blog-CSDN Blog Cheng
process
1. In the background management, create an application and select a consumer
2. The client uses uniwebview for web page access
3. Permission request
Request URI:
https://api.instagram.com/oauth/authorize?client_id={0}&scope=user_profile&redirect_uri={1}&response_type=code
4. Redirection
It needs to be received at the redirection address. Here I use uniwebview, so I directly parse the returned URI to get the data I need.
5. User application
https://api.instagram.com/oauth/access_token
The POST request used, the parameters are as follows:
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返回的数据中获取
dic.Add("redirect_uri", REDIRECT_URI);
dic.Add("grant_type", "authorization_code");
6. Obtain user information
/// <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";
parameter
?fields=id,username&access_token=
access_token is obtained from the data returned in the previous step.
Precautions
1. If uniwebview is not applicable, you need to receive the data returned by instagram in your redirect_uri, and send the corresponding parameters to the app or web page according to actual needs.
epilogue
The writing is not very clear. If you have something you don’t understand or something wrong, please leave a message.