dqprf0976 2013-07-09 22:26 采纳率: 100%
浏览 102
已采纳

使用2leg oauth令牌调用Bitbucket REST API

I am trying to call bitbucket's api using 2-legged oauth authentication.

I call

https://bitbucket.org/!api/1.0/oauth/request_token

with my oauth secret and key and get the following:

oauth_token_secret=<token_secret>&oauth_token=<token>&oauth_callback_confirmed=true

How can I use this to call an api function, such as

https://bitbucket.org/api/1.0/user 
  • 写回答

1条回答 默认 最新

  • douchun1900 2013-07-10 09:37
    关注

    After you have received accesstoken & secret, when you send the request add a (Authorization) Header as,

    Authorization: OAuth oauth_consumer_key="<YourKey>",oauth_signature_method="HMAC-SHA1",oauth_timestamp="<TIMESTAMP>",oauth_nonce="2694561796",oauth_version="1.0",oauth_signature="<Signature>"
    

    where,

    TIMESTAMP= current epoch (ms) oauth_nonce random number

    Important thing is oauth_signature

    Read through here on how to generate,

    Oauth 1.0 Signature

    Signature has to be precalculated before sending the request. And this will do it.

    To test it you can tryout it here, Apigee Bitbucket API Console

    PS: Its weird that Bit Bucket uses OAuth 1.0, well known for its vulnerabilities.

    Session Fixation Attack

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?