Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

http authorization header in html

I need help in setting the authorization header in html file. So I used OAuth tool on dev.twitter.com and got this header content:

Authorization: OAuth oauth_consumer_key="BKsXdR3SO4hSZyFT2JevHQ", oauth_nonce="718a5099a51230e737474c7e76d21581", oauth_signature="rQ5DJWi8qMmdR76rwIOwJYUhuvc%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1341342796", oauth_token="69848552-B6geQZCA8ttirQIMKrIk47SOE541V7d5ZcYwEBUqQ", oauth_version="1.0"

Now I don't know what to do. I tried this:

<meta name="Authorization" content="OAuth" 
    oauth_consumer_key="BKsXdR3SO4hSZyFT2JevHQ", 
    oauth_nonce="b98cf39b3f8dba6286cbd1b741eb7504", 
    oauth_signature="Vgmudlrkv1dzFel9zpFztXfR6gI%3D", 
    oauth_signature_method="HMAC-SHA1", 
    oauth_timestamp="1341339879", 
    oauth_token="69848552-B6geQZCA8ttirQIMKrIk47SOE541V7d5ZcYwEBUqQ", 
    oauth_version="1.0">

But it doesn't work! I am sure doing something wrong.

Help, please!

Aram.

like image 243
user1499804 Avatar asked Jan 23 '26 11:01

user1499804


1 Answers

There's an essential difference of headers. OAuth requires an "Authorization" on HTTP header, not in HTML header.

POST /1/statuses/update.json?include_entities=true HTTP/1.1
Accept: */*
Connection: close
User-Agent: OAuth gem v0.4.4
Content-Type: application/x-www-form-urlencoded
Authorization: 
        OAuth oauth_consumer_key="xvz1evFS4wEEPTGEFPHBog", 
              oauth_nonce="kYjzVBB8Y0ZFabxSWbWovY3uYSQ2pTgmZeNu2VS4cg", 
              oauth_signature="tnnArxj06cWHq44gCs1OSKk%2FjLY%3D", 
              oauth_signature_method="HMAC-SHA1", 
              oauth_timestamp="1318622958", 
              oauth_token="370773112-GmHxMAgYyLbNEtIKZeRNFsMKPR9EyMZeS9weJAEb", 
              oauth_version="1.0"
Content-Length: 76
Host: api.twitter.com

You can set this headers on a request through server-side scripting (with PHP, Python, ...)

like image 122
anibalsolon Avatar answered Jan 26 '26 03:01

anibalsolon