溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

手機(jī)第三方新浪微博登錄php api實(shí)現(xiàn)分析

發(fā)布時(shí)間:2020-06-06 15:51:34 來源:網(wǎng)絡(luò) 閱讀:648 作者:ljianbing 欄目:web開發(fā)

    提供api,POST方式,根據(jù)傳遞過來的微博uid/appkey,判斷該用戶的ID是否在自己的數(shù)據(jù)庫中。

    如果有,直接登錄返回用戶登錄api的json。

    如果沒有,就將該用戶的ID+token請求微博用戶信息api:http://open.weibo.com/wiki/2/users/show,根據(jù)返回的用戶信息json數(shù)據(jù)在數(shù)據(jù)庫中創(chuàng)建新用戶。再執(zhí)行登錄,返回用戶登錄的json。  

    使用微博 php sdk,根據(jù)微博返回的token值,獲得用戶信息。


    微博授權(quán)返回post參數(shù)

    {

           "uid": 1073880650, 

           "appkey": 1352222456,

           "scope": null,

           "create_at": 1352267591,

           "expire_in": 157679471,

         "token":xxxxx,

         "source_add":"ios"

    

     }

    微博用戶信息api返回實(shí)例json

    {

        "id": 1404376560,

        "screen_name": "zaku",

        "name": "zaku",

        "province": "11",

        "city": "5",

        "location": "北京 朝陽區(qū)",

        "description": "人生五十年,乃如夢如幻;有生斯有死,壯士復(fù)何憾。",

        "url": "http://blog.sina.com.cn/zaku",

        "profile_p_w_picpath_url": "http://tp1.sinaimg.cn/1404376560/50/0/1",

        "domain": "zaku",

        "gender": "m",

        "followers_count": 1204,

        "friends_count": 447,

        "statuses_count": 2908,

        "favourites_count": 0,

        "created_at": "Fri Aug 28 00:00:00 +0800 2009",

        "following": false,

        "allow_all_act_msg": false,

        "geo_enabled": true,

        "verified": false,

        "status": {

            "created_at": "Tue May 24 18:04:53 +0800 2011",

            "id": 11142488790,

            "text": "我的相機(jī)到了。",

            "source": "<a rel="nofollow">新浪微博</a>",

            "favorited": false,

            "truncated": false,

            "in_reply_to_status_id": "",

            "in_reply_to_user_id": "",

            "in_reply_to_screen_name": "",

            "geo": null,

            "mid": "5610221544300749636",

            "annotations": [],

            "reposts_count": 5,

            "comments_count": 8

        },

        "allow_all_comment": true,

        "avatar_large": "http://tp1.sinaimg.cn/1404376560/180/0/1",

        "verified_reason": "",

        "follow_me": false,

        "online_status": 0,

        "bi_followers_count": 215

    }



http://open.weibo.com/wiki/API%E6%96%87%E6%A1%A3_V2#OAuth3

http://open.weibo.com/wiki/API%E6%96%87%E6%A1%A3_V2#.E7.94.A8.E6.88.B7

http://blog.csdn.net/daleiwang/article/details/34081231

http://wiki.mob.com/%e5%ae%9e%e7%8e%b0%e7%ac%ac%e4%b8%89%e6%96%b9%e7%94%a8%e6%88%b7%e7%99%bb%e5%bd%95/


==========公共登錄安全說明=======================

1、登錄安全判斷,防止惡意猜測用戶id登錄。

沒有uid進(jìn)行的的登錄進(jìn)行l(wèi)og記錄


2、其他登錄安全判斷,防止惡意猜測用戶密碼。

密碼1小時(shí)內(nèi)連續(xù)驗(yàn)證10次失敗后,鎖定3小時(shí)不能登錄。用戶在4小時(shí)內(nèi)連續(xù)有20次錯(cuò)誤登錄,進(jìn)行賬號凍結(jié)24小時(shí)。工作日進(jìn)行登錄接口的url訪問日志排除,防止固定ip的惡意猜測用戶密碼行為。產(chǎn)品防止出現(xiàn)全稱用戶列表,防止被利用猜測用戶密碼。


向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI