如何获取Pinterest的V3 API-KEY或的access_token [英] How to obtain Pinterest V3 API-KEY or access_token

查看:383
本文介绍了如何获取Pinterest的V3 API-KEY或的access_token的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图获取Pinterest的数据,这将是用户的公开信息(跟随数等),并为用户所有引脚。

I am trying to fetch Pinterest data, which would be the public info of the user(follower count etc), and all pins for a user.

我知道V3 API均达到现在和v2 API已经被撤下。

I know the v3 API are up now and v2 apis have been taken down.

我发现这个链接,让我结束点正是我想要的:

I found this link which gives me end points for exactly what I want:

<一个href=\"http://techslides.com/most-repinned-pinterest-pins-by-website/\">http://techslides.com/most-repinned-pinterest-pins-by-website/

但我无法获取的access_token。我要求API访问Pinterest的,但他们并没有回答。而我无法嗅探程序的数据了。

But I am unable to get an access_token. I have asked pinterest for api access but they have not replied. And I am unable to sniff app data too.

我也试过Pinterest的签名测试工具,它是在他们的网站,但没有运气。它生成的链接也不起作用。它返回一个授权失败。

I also tried Pinterest's signature tester tool which is on their website but no luck. The link it generates doesn't work either. It returns a authorization failure.

<一个href=\"https://developers.pinterest.com/tools/signature/\">https://developers.pinterest.com/tools/signature/

我有机会获得APP-ID和客户端秘密。我需要知道我怎么能得到一个访问令牌/ API-Key能够得到以下工作对我罚款:

I have access to APP-ID and Client-Secret. I need to know how can I get an access token/ API-KEY to get the following work fine for me:

<一个href=\"https://api.pinterest.com/v3/users/jessicamalba/?access_token=APIKEY\">https://api.pinterest.com/v3/users/jessicamalba/?access_token=APIKEY

修改

在我被告知这是一个重复

Before I am told that is an duplicate of

<一个href=\"http://stackoverflow.com/questions/12870416/how-to-get-access-token-for-access-pinterest-api?rq=1\">How以获得访问令牌访问Pinterest的阿比

我只想说,事实并非如此。这个问题被问一年前,并要求在尊重V2 API。现在返回 404 状态。所以,现在我在这里问的是V3 API。

I would just say that it is not. This question was asked one year ago and was asked in respect to V2 api. Which now return a 404 status. So now here I am asking about the V3 api.

推荐答案

要preface,我看到了一些讨论,即使你可以得到令牌,它可能无法工作,除非你是一个已获批准的开发。所以,你可能会考虑申请成为API开发人员,你需要等待来尝试所有这一点。另外V3是测试版,所以..这个答案可能会为现在的工作但是,它可能以后如果它最终没有被获得令牌的官方途径出来时,测试版无法正常工作。

To preface, I saw some discussion that even though you can get the token, it may not work unless you are an approved developer. So you might consider applying to be an API developer while you wait to try to work all this out. Also V3 is beta, so.. This answer might work for now however, it may not work later if it ends up not being the official way to get the token when it comes out of beta.

第一步:登录到Pinterest的,那么你需要创建在 HTTPS的应用程序://开发商。 pinterest.com/manage/ 链接,您也可以从Pinterest上的主要开发者页面获得。我选择创建iPhone应用程序,即使我不打算与IOS用这个,只是让我能得到创建尽量使API工作的应用程序。

Step one: Log into pinterest then you need to create an application on the https://developers.pinterest.com/manage/ link which you can also get from the main developers page on pinterest. I chose to create IOS application, even though I don't plan to use this with IOS, just so I could get an application created to try to make the API work.

创建应用程序的一部分,要求您指定一个回调URL,这是您的网站上将会收到令牌放大器的URL;哈希标签标记的相关数据{I presume他们这样做,这样只有JavaScript可以得到它,而不是PHP直接}然而,你可以修改的javascript这个标签下降哈希并将其重定向到另一个网址可收集它作为获取或交PARAMS。

Part of the creation of the app, asks you to specify a callback url, this is the url on your website that is going to receive the token & token related data in a hash tag {I presume they did this so that only javascript can get at it rather than php directly} however you could modify the hashtag in javascript to drop the hash and redirect it to another url which can collect it as get or post params.

在创建替代的应用程序ID为1412345(即consumer_id,有时也被称为CLIENT_ID)到下面的网址。

Once created replace the application id "1412345" (i.e. consumer_id, also sometimes called client_id) into the url below.

我所看到的是这个数字始于14 ......在present

What I have seen is this number starts with 14...... at present

<一个href=\"https://www.pinterest.com/oauth/?consumer_id=1412345&response_type=token\">https://www.pinterest.com/oauth/?consumer_id=1412345&response_type=token

第二步:上面的网址执行将带给你一个页面,要求您授权访问您的用户帐户的应用程序。一旦批准它会令牌发送回您的网站。哈希标签,您可以使用JavaScript来读这个标签

Step two: The executed url above will bring you to a page asking you to authorize the application to access your user account. Once you authorize it it will send the token back to your website. in the hash tag and you can use javascript to read the hashtag

window.location.hash.substr(1,window.location.hash.length)将让你含(以相当于30天秒的持续时间),并token_type这将等于的access_token,expires_at从哈希标签的get PARAMS字符串承载

window.location.hash.substr(1, window.location.hash.length) will get you the get params string from the hash tag containing access_token, expires_at (duration in seconds which equals 30 days) and token_type which will equal "bearer"

请注意令牌将被base_64 EN codeD,如果它应该保持这种方式我不知道可以使用,但我presume左右。

Note the token will be base_64 encoded, I don't know if it's supposed to stay that way to be used but I presume so.

这篇关于如何获取Pinterest的V3 API-KEY或的access_token的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆