开发者

HTTP Basic Authentication on Gowalla?

I am writing a perl script that sh开发者_StackOverflow社区ould login to Gowalla, fetch some information and check in. Looking at the http://api.gowalla.com/api/docs I don't find a way to "login". It seems they want every request to include the username and the password.

I thought it should be possible to first "login" and then use the supplied cookie to keep the conversation.

Am I missing something there or is that the case?


It says they use Basic Authentication. If you are using the LWP type of thing:

my $req = HTTP::Request->new( POST => 'http://somesite.com/');
$req->authorization_basic('username', 'password');

# using data supplied by the other answer.
$req->header( 'X-Gowalla-API-Key' => 'YOURKEY' );
my $resp = $ua->request($req);


Their API simply does not allow what you ask for. Quoting,

All authentication is handled with HTTP Basic Authentication. All calls must also include your Gowalla API Key in a X-Gowalla-API-Key request header.

Nowhere in the document is mentioned "cookie", either.

So every time you want to make a request to them, you must supply both the HTTP basic auth info, and the X-Gowalla_API-Key HTTP header.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜