首先,注册应用程序并设置重定向URI:
https://developers.pinterest.com/manage/
然后,在签名测试器下找到客户端密钥:
https://developers.pinterest.com/tools/signature/
像这样将用户带到OAuth对话框:
如果响应类型为token,则会将其附加为重定向URI中的哈希值。
如果响应类型为code,请参阅下面的文章了解如何交换代码以获取令牌的详细信息:
当您登录时,需要在下拉菜单的“管理应用程序”选项下注册客户端应用程序。
或者
https://developers.pinterest.com/manage/
注册您的应用程序,您将获得AppID。
请按照您拥有的链接中的流程进行操作。
希望这可以帮到你。**USING C#**
public string GetOAuthToken(string data)
{
string strResult = string.Empty;
try
{
string Clientid = WebConfigurationManager.AppSettings["Pinterest_Clientid"];
string ClientSecret = WebConfigurationManager.AppSettings["Pinterest_ClientSecret"];
string uri_token = WebConfigurationManager.AppSettings["Pinterest_Uri_Token"];
System.Net.HttpWebRequest req = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(uri_token);
string parameters = "grant_type=authorization_code"
+ "&client_id="
+ Clientid
+ "&client_secret="
+ ClientSecret
+ "&code="
+ data;
req.ContentType = "application/x-www-form-urlencoded";
req.Method = "POST";
byte[] bytes = Encoding.ASCII.GetBytes(parameters);
System.IO.Stream os = null;
req.ContentLength = bytes.Length;
os = req.GetRequestStream();
os.Write(bytes, 0, bytes.Length);
System.Net.WebResponse webResponse = req.GetResponse();
System.IO.Stream stream = webResponse.GetResponseStream();
System.IO.StreamReader reader = new System.IO.StreamReader(stream);
string response = reader.ReadToEnd();
Newtonsoft.Json.Linq.JObject o = Newtonsoft.Json.Linq.JObject.Parse(response);
strResult = "SUCCESS:" + o["access_token"].ToString();
}
catch (Exception ex)
{
strResult = "ERROR:" + ex.Message.ToString();
}
return strResult;
}