V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
ifconfig
V2EX  ›  PHP

PHP 下 API 接口安全,大家怎样做的?

  •  
  •   ifconfig · 2015-05-13 16:50:15 +08:00 · 5932 次点击
    这是一个创建于 3272 天前的主题,其中的信息可能已经有所发展或是发生改变。
    不可能每次都传user_id吧,目前是想让前端登录后提供access_token.而且这个token一段时间后会换
    然后TP框架下了解到有OAuth,但是实现起来有点麻烦,鄙人有点笨看不懂,哭.......
    Larval可以用jwt-auth,但是这个包不稳定,经常出小问题,现在发现post提交不能拿到token。

    所以跪求各位安全这方面大家如何解决的,或者用哪些包解决的?
    14 条回复    2015-05-14 15:55:56 +08:00
    moro
        1
    moro  
       2015-05-13 16:54:03 +08:00
    签名,参考支付类接口
    wy315700
        2
    wy315700  
       2015-05-13 16:54:28 +08:00
    session
    GuangXiN
        3
    GuangXiN  
       2015-05-13 17:06:02 +08:00
    access_token的意义约等于session_id
    lijinma
        4
    lijinma  
       2015-05-13 17:25:01 +08:00
    oauth2.0 access_token https
    lijinma
        5
    lijinma  
       2015-05-13 17:25:31 +08:00
    Laravel 我用的 dingo/api 直接支持 oauth2.0,你只需要搞一个 https 就好了
    lvfujun
        6
    lvfujun  
       2015-05-13 17:26:57 +08:00
    如果不是机密数据. access_token 足够了.
    vibbow
        7
    vibbow  
       2015-05-13 17:29:58 +08:00
    直接双向ssl认证......
    huigeer
        8
    huigeer  
       2015-05-13 17:35:57 +08:00
    ssl + 1
    kslr
        9
    kslr  
       2015-05-13 17:58:21 +08:00
    token
    oauth2
    rsa
    gdtv
        10
    gdtv  
       2015-05-13 18:05:15 +08:00
    我以前问过类似的问题,楼主可以参考一下:
    https://v2ex.com/t/166882
    crayhuang
        11
    crayhuang  
       2015-05-13 23:26:52 +08:00
    token+signature
    michaelzlies
        12
    michaelzlies  
       2015-05-14 11:23:47 +08:00
    michaelzlies
        13
    michaelzlies  
       2015-05-14 11:26:37 +08:00
    验证的时候用header

    Authorization: Bearer {token}
    ifconfig
        14
    ifconfig  
    OP
       2015-05-14 15:55:56 +08:00
    @michaelzlies 方便留下企鹅号问你具体问题吗?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2700 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 11:07 · PVG 19:07 · LAX 04:07 · JFK 07:07
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.