I am trying to integrate hip chat i my website.
Hip chat doc
我想整合我的网站髋关节聊天。嘻哈聊天文档
I go through above doc.But i am able to understand how to start. They are saying to create add on and many thing. Using api i am able to post and get data but of only one user. I want to integrate Hip chat like a chat server in my website but i don't
How to start and how to implement that. If any one have example or demo plz help me.
Below is the code what i tried:
我通过上面的doc.But我能够理解如何开始。他们说要创造附加和许多东西。使用api我能够发布和获取数据,但只有一个用户。我想在我的网站中集成Hip聊天,就像聊天服务器,但我不知道如何开始以及如何实现它。如果任何人有示例或演示PLZ帮助我。以下是我试过的代码:
// getting all room information
// Rooms
"https://api.hipchat.com/v2/room?auth_token=XXXXXX"
//message to room
https://api.hipchat.com/v2/room/2068981/notification?auth_token=XXXXXX
//Message history
https://api.hipchat.com/v2/room/2068981/history?auth_token=XXXXXX&max-results=1000&reverse=true
this code are working fine .But it is only working for one user i want it to work of all user . And I am also not able to generate access token for every user automatically. I tried for access token :
这段代码工作正常。但它只适用于一个用户,我希望它能够为所有用户工作。而且我也无法自动为每个用户生成访问令牌。我试过访问令牌:
curl -d '{"username":"abc@rediff.com","grant_type":"password","password":"XXXX"}' -H 'Content-Type: application/json' https://domain.hipchat.com/v2/oauth/token
{
"error": {
"code": 401,
"message": "Authenticated requests only. See https://www.hipchat.com/docs/apiv2/auth for more information.",
"type": "Unauthorized"
1 个解决方案
#1
1
I think you will not be able to post on behalf of all users using just one token. It's a security issue. Instead you may need to do the following
我认为您无法仅使用一个令牌代表所有用户发帖。这是一个安全问题。相反,您可能需要执行以下操作
- Require users to login in your website
- 要求用户登录您的网站
- Create an page for them to grant access to HipChat
- 为他们创建一个页面以授予对HipChat的访问权限
- Bind the access token returned from HipChat to their profile in your website
- 将从HipChat返回的访问令牌绑定到您网站中的个人资料
- Use corresponding token to post on behalf of users when they logged in
- 使用相应的令牌在用户登录时代表用户发布
#1
1
I think you will not be able to post on behalf of all users using just one token. It's a security issue. Instead you may need to do the following
我认为您无法仅使用一个令牌代表所有用户发帖。这是一个安全问题。相反,您可能需要执行以下操作
- Require users to login in your website
- 要求用户登录您的网站
- Create an page for them to grant access to HipChat
- 为他们创建一个页面以授予对HipChat的访问权限
- Bind the access token returned from HipChat to their profile in your website
- 将从HipChat返回的访问令牌绑定到您网站中的个人资料
- Use corresponding token to post on behalf of users when they logged in
- 使用相应的令牌在用户登录时代表用户发布