php - How to integrate hipchat in a website? -
i trying integrate hip chat website.
hip chat doc
i go through above doc.but able understand how start. saying create add on , many thing. using api able post , data of 1 user. want integrate hip chat chat server in website don't
how start , how implement that. if 1 have example or demo plz me.
below code tried:
// getting room information // rooms "https://api.hipchat.com/v2/room?auth_token=xxxxxx" //message 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 working fine .but working 1 user want work of user . , not able generate access token every user automatically. tried 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 more information.", "type": "unauthorized"
i think not able post on behalf of users using 1 token. it's security issue. instead may need following
- require users login in website
- create page them grant access hipchat
- bind access token returned hipchat profile in website
- use corresponding token post on behalf of users when logged in
Comments
Post a Comment