tanteng
V2EX  ›  PHP

授权用的 APPSecret 一般是什么算法生成的呢?

  •  
  •   tanteng · May 21, 2015 · 8896 views
    This topic created in 4035 days ago, the information mentioned may be changed or developed.

    如图,在做服务器给第三方授权的时候,申请接口授权的一方往往要获得APPKEY和APPSecret,它们一般都是根据什么算法生成的?可以的话有代码示例更好了,谢谢!
    4 replies    2015-05-22 11:45:12 +08:00
    oa414
        1
    oa414  
       May 21, 2015
    之前自己做的是随机生成一串16进制数。
    ```ruby
    app_secret = SecureRandom.hex(32)
    ```
    wy315700
        2
    wy315700  
       May 22, 2015
    /dev/urandom
    powergx
        3
    powergx  
       May 22, 2015 via iPhone
    uuid
    julyclyde
        4
    julyclyde  
       May 22, 2015
    考虑到“可吊销性”这个需求,ID和secret不应该有任何算法上的联系
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   6020 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 53ms · UTC 03:18 · PVG 11:18 · LAX 20:18 · JFK 23:18
    ♥ Do have faith in what you're doing.