zoukankan      html  css  js  c++  java
  • 前端-【学习心得】-合作登录相关

    qq互联:http://wiki.connect.qq.com/

    微信开放平台:https://open.weixin.qq.com/

    微博开放平台:http://open.weibo.com/authentication/

    新浪微博平台的合作登录步骤:

    1.  放置微博图标      

    2. 界面上设置授权链接:https://api.weibo.com/oauth2/authorize?client_id=4087672060&redirect_uri=http://www.putaoyun.com/wechatexe/getback&response_type=code

    3.用户点击授权后:在redirect_uri得到 code和state参数;

    4. 根据code参数获得access_token;POST https://api.weibo.com/oauth2/access_token结果返回:{"access_token":"2.00vwgRhFWO9d9Ea8baa972cbhsdQqB","remind_in":"157679999","expires_in":157679999,"uid":"5220263285"}这个uid并非客户的uid而是公司的账户uid

    5. 获得用户uidhttps://api.weibo.com/2/account/get_uid.jsonget参数:access_token6. 然后根据accesstoken和uid获得用户信息GET:https://api.weibo.com/2/users/show.json{参数就是access_token 和uid}

    qq合作登录步骤:

    1. 放置qq图标

    2.  放置授权链接 "https://graph.qq.com/oauth2.0/authorize?response_type=token&client_id=101147632&redirect_uri=http%3A%2F%2Fwww.xxxx.com%2Fcallback&state=buygrape&scope=get_user_info"

    3.  用户授权后服务器设置的回调地址www.xxxx.com/callback收到code 和state

    4.  通过code获得accesstokenhttps://api.weixin.qq.com/sns/oauth2/access_token?appid=wx8e5aa9f3c86301a8&secret=6fc7e7d9da63acfaf5eb6fdcdbe5e71f&code=" +code+ "&grant_type=authorization_code                             成功返回: access_token=FE04************************CCE2&expires_in=7776000&refresh_token=88E4************************BE14‘;本次缓存token,refresh_token 过期时间为3个月过期后延长办法:https://graph.qq.com/oauth2.0/token?grant_type=refresh_token&client_id=xxx&client_secret=xxxx&refresh_token=上个步骤中获得的

    5. 获得openidhttps://graph.qq.com/oauth2.0/me?access_token=xxx

    6.根据access_token和openid获得用户信息https://graph.qq.com/user/get_user_info?access_token=*************&oauth_consumer_key=12345&openid=****************

    oauth_consumer_key    申请QQ登录成功后,分配给应用的appid    

    返回:{ "ret":0, "msg":"", "nickname":"Peter", "figureurl":"http://qzapp.qlogo.cn/qzapp/111111/942FEA70050EEAFBD4DCE2C1FC775E56/30", "figureurl_1":"http://qzapp.qlogo.cn/qzapp/111111/942FEA70050EEAFBD4DCE2C1FC775E56/50", "figureurl_2":"http://qzapp.qlogo.cn/qzapp/111111/942FEA70050EEAFBD4DCE2C1FC775E56/100", "figureurl_qq_1":"http://q.qlogo.cn/qqapp/100312990/DE1931D5330620DBD07FB4A5422917B6/40", "figureurl_qq_2":"http://q.qlogo.cn/qqapp/100312990/DE1931D5330620DBD07FB4A5422917B6/100", "gender":"男", "is_yellow_vip":"1", "vip":"1", "yellow_vip_level":"7", "level":"7", "is_yellow_year_vip":"1" } 微信联合登录步 骤: 1. 放按钮

    2.取codehttps://open.weixin.qq.com/connect/qrconnect?appid=APPID&redirect_uri=REDIRECT_URI&response_type=code&scope=SCOPE&state=STATE#wechat_redirect

    3. 取access_tokenhttps://api.weixin.qq.com/sns/oauth2/access_token?appid=APPID&secret=SECRET&code=CODE&grant_type=authorization_code结果返回:{  "access_token":"ACCESS_TOKEN",  "expires_in":7200,  "refresh_token":"REFRESH_TOKEN", "openid":"OPENID",  "scope":"SCOPE"  }过期后刷新tokenhttps://api.weixin.qq.com/sns/oauth2/refresh_token?appid=APPID&grant_type=refresh_token&refresh_token=REFRESH_TOKEN返回:{  "access_token":"ACCESS_TOKEN",  "expires_in":7200,  "refresh_token":"REFRESH_TOKEN",  "openid":"OPENID",  "scope":"SCOPE"  } 4. access_token调用接口  还好这里openid返回了https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN

  • 相关阅读:
    使用UGUI实现拖拽功能(拼图小游戏)
    Lua入门基础
    (改)编程实验一 词法分析程序
    编程实验一 词法分析程序
    0909编译原理
    1014 C语言文法定义与C程序的推导过程
    词法分析总结
    0916作业二词法分析
    0909有关编译原理的解释
    语音文法
  • 原文地址:https://www.cnblogs.com/wq123/p/4396463.html
Copyright © 2011-2022 走看看