Disqus - 如何通过登录用户当前的? [英] Disqus - How to pass current logged in user?

查看:179
本文介绍了Disqus - 如何通过登录用户当前的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Disqus API来获取登录的用户的详细信息。我不知道如何通过当前登录的用户。

I am using Disqus API to fetch details of the logged in user. I am not sure how to pass the current logged in user.

我都API_KEY(公共)和remote_auth,我使用Jquery AJAX发送过来HTTP API请求。

I have both api_key(public) and remote_auth and I am using Jquery ajax to send api request over http.

如果我做这样的事情,

https://disqus.com/api/3.0/用户/ details.json?API_KEY = [apikey]

它说:你必须要么提供一个用户或验证用户。现在我有用户的loggedIn remote_auth。

It says "You must either provide a user or authenticate the user." Now I have the loggedin users remote_auth.

FYI:这是我如何创建remote_auth。例如用户ID:3096795,电子邮件=a@a.com,名称=测试。现在,当到这个网站的用户登录时,登录到Disqus为好。我可以在 http://disqus.com/api/sso/users/ 查看此用户使用id = 3096795。

FYI: This is how I am creating the remote_auth. Example User Id: 3096795, email = "a@a.com", Name="Test". Now when this user logs in to the website, it logs in to Disqus as well. I can see this user in http://disqus.com/api/sso/users/ with id = 3096795.

我有几个问题:

1),我可以使用jQuery的ajax发送验证的用户,并得到用户的详细信息?或者,这只能通过服务器端来完成? (Jav​​a / PHP)

1) Can I use jquery ajax to send a authenticated user and get user details? Or this can be done only via Server side? (Java/Php)

2)如果我通过?remote_auth = [remote_auth]作为查询字符串,将它的工作?

2) If I pass ?remote_auth=[remote_auth] as a query string, will it work?

3)如果是,remote_auth值有空格,SHA1(SECRET_KEY,消息+''+时间戳),所以我怎么可以把它作为查询字符串参数?

3) if yes, remote_auth value has spaces in between HMAC->SHA1(secret_key, message + ' ' + timestamp) so how can I pass it as query string parameter?

4)如果没有,那么如何通过用户的 listActivity.json 终点?如果我传递的用户ID,则返回我一些其他的用户,而不是我创建的用户。

4) If no, then how to pass a user to the listActivity.json endpoint? If I am passing the userid, then it returns me some other user and not the user I created.

下面的请求返回不同的用户。

The below request returns a different user.

https://disqus.com/api/3.0/users/details.json?api_key=[apikey]&user=3096795

我如何能确保我传递的用户ID是唯一的,而不是已经采取的不同disqus帐户?

How can I ensure the userid I am passing is unique and not already taken by a different disqus account?

我缺少的东西吗?

推荐答案

remote_auth 是的认证,就像的access_token 的形式,所以你要传递,在您的要求为 remote_auth =< YOUR_PAYLOAD方式>

Your remote_auth is a form of authentication, just like access_token, so you'll want to pass that in your request as remote_auth=<YOUR_PAYLOAD>.

如果您通过用户=该ID必须是Disqus用户ID,这是不一样的你remote_auth ID。你remote_auth是身份验证的一种形式,就像的access_token。但是,请记住,我们没有为SSO用户尽可能多的细节回来作为身份验证的用户Disqus。这是因为细节是由您管理的,SSO网站的所有者。

If you pass "user=" that ID would have to be the Disqus user ID, which isn't the same as your remote_auth ID. Your remote_auth is a form of authentication, just like the access_token. However, keep in mind that we don't return as many details for SSO users as authenticated Disqus users. This is because the details are managed by you, the SSO site owner.

要回答你的其他问题:


  1. 您可以使用客户端API来获取这些细节,但我们建议在服务器端API +缓存结果以避免碰撞到API的限制。

  1. You can use the client-side API to get these details, but we recommend the server-side API + caching the results to avoid bumping into API limits.

URL-CN code中的有效载荷,这将正常工作

URL-encode the payload and this will work

这篇关于Disqus - 如何通过登录用户当前的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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