V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
ljbha007
V2EX  ›  问与答

关于OAuth 2.0的疑问

  •  
  •   ljbha007 · 2013-04-25 22:03:05 +08:00 · 3064 次点击
    这是一个创建于 3990 天前的主题,其中的信息可能已经有所发展或是发生改变。
    今天研究了一下新浪的API,看到他们Android-SDK里边的这段代码:
    https://github.com/mobileresearch/weibo_android_sdk/blob/master/weibo.sdk.android.sso.demo/src/com/weibo/sdk/android/WeiboDialog.java

    我看到这个代码里边调用了新浪的OAuth 2.0认证中的authorize API,
    但是在我阅读了新浪官方的authorize API的文档(http://open.weibo.com/wiki/Oauth2/authorize)后,发现此处代码中的协议和文档中的协议并不一致:
    1、文档中的URL地址为:https://api.weibo.com/oauth2/authorize, 代码中的URL地址为:https://open.weibo.cn/oauth2/authorize。尽管文档中有提到当display=mobile时“请使用https://open.weibo.cn/oauth2/authorize”,但是并没有提到这个地址的返回值。
    2、使用https://api.weibo.com/oauth2/authorize时,返回的参数是Authorization Code,调用者需要使用此Code加上app_id和app_secret去向https://api.weibo.com/oauth2/access_token获取最终使用的access_token;
    而使用https://open.weibo.cn/oauth2/authorize时,返回参数中直接就有了access_token。

    此时我有一个非常大的疑问:
    如果有人通过应用调试功能或者其他任何方式获取了我的client_id和redirect_url就可以毫无阻拦的使用我的client_id吗?

    试想如果我的client_id有大量的用户已经对其授权过,那岂不是这些用户的数据也可以随意被人通过获取此client_id来取得?
    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1213 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 18:09 · PVG 02:09 · LAX 11:09 · JFK 14:09
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.