User API error


#1

We are facging issues regarding User API.
Please let us know that why API of User returns “Invalid or expired token.”, and what should we do for covering it?
The formats of request and response are as follows

REQUEST

GET /1.1/users/show/1499659956.json HTTP/1.1
Authorization: OAuth realm=“http://api.twitter.com”, oauth_consumer_key="", oauth_nonce=“c276d933cafd4e3dbaed71ec39b391de”, oauth_signature_method=“HMAC-SHA1”, oauth_timestamp=“1430957439”, oauth_token="", oauth_version=“1.0”, oauth_signature="*"
User-Agent: SamsungMobile SNS Gateway
Host: api.twitter.com
Content-Type: text/xml
Proxy-Connection: Close
Connection: Close

RESPONSE

HTTP/1.1 401 Authorization Requiredconnection:close
content-length:62
content-type:application/json;charset=utf-8
date:Thu, 07 May 2015 00:06:56 GMT
server:tsa_b
set-cookie:guest_id=v1%3A143095721658563344; Domain=.twitter.com; Path=/; Expires=Sat, 06-May-2017 00:06:56 UTC
strict-transport-security:max-age=631138519
x-connection-hash:dadd7764b1e5970e4a3922259390c849
x-response-time:8

{“errors”:[{“code”:89,“message”:“Invalid or expired token.”}]}


#2

It sounds like you are using a wrong OAuth header. Please note that the OAuth headers need to be generated on each request as it contains the current time and related information that are only valid for a short period of time!
Additionally your Content-Type: text/xml is not correct.


#3