openid

小程序如何判断用户(后台使用Django)

守給你的承諾、 提交于 2019-12-06 14:05:09
小程序如何判断用户是哪个: 有Web开发经验的都知道,客户端用户发起请求,服务器收到请求后,可以通过把用户user_id记录到session里,然后下次通过session里面的user_id来辨别是哪个用户,然而小程序里面对于没有唯一的标识符,只有(昵称,性别等),如果这些信息用户一旦修改,服务器就没法进行辨别了,微信官方提供了一个接口wx.login,用于用户获取自己的code,用户获取code后将code发送到服务器,服务器然后通过微信官方接口,获取用户的唯一标识符openid和session_key,为了安全性,服务器不要把openid直接暴露给用户,可以自己随机生成一个字符串,然后将这个字符串与这个用户的openid session_key关联起来,然后把这个随机的字符串传送给用户,这个随机生成的字符串就代替了openid(也叫做用户态)。用户获取到用户态后可以将其存储到storage中,因为小程序没有cookie的功能,所以以后每次发起请求,可以把storage存储的用户态放到header中,这样服务器可以从header中获取用户态来辨别是哪个用户了,然后就可以进行业务逻辑 数据返回了! ①:第一次进入此小程序的用户: onLogin: function () { console.log('logining1') this.getuserinfo var that =

微信红包扫雷二维码公众号开发

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 13:53:55
最新研究微信红包接口的问题真是困扰了我好久,因为微信的api 实在是太坑爹了 ,如果没有大量的测试是行不通的,我是拼凑的所有人的集合才弄明白,接下来跟大家分享一下java 结合jsp ,两个服务器如何实现 微信扫码二维码 然后公众号发放红包的例子。 1.准备工作先不说了(比如验证回调函数服务器域名啊、程序必须部署在80端口等等,开通微信支付等功能,这个微信api 说的很清晰),需要两个程序 ,一个作为微信接口的回掉函数程序用来获取 code(简称服务器A),另一个作为调取发送红包的程序(简称服务器B)。(java 端jar包就不写了直接写方法) 2.首先在A服务器上部署back.html页面 ,然后用生成二维码工具将此页面路径生成二维码,页面自动授权跳转到回第二个页面 getback.html <!doctype html> <html> <head> <meta http-equiv="content-type" content="txt/html; charset=utf-8"/> <script type="text/javascript" src="jquery-1.8.3.js"></script> <script type="text/javascript"> $(document).ready(function () { window.location.href =

Can I use the facebook credentials to for users to access my site?

一世执手 提交于 2019-12-06 11:45:17
This question was migrated from Server Fault because it can be answered on Stack Overflow. Migrated 10 years ago . I'm starting to work on a site that will be strongly connected to a corresponding Facebook app. I want the contents to be free for all to view, but only registered users will be able to edit it (quite similar to serverfault , actually). Since I think that most of my users will be logged in to facebook, I would really like to use their facebook credentials as to login to my site - the same way Open-Id registration works here. Can this be done? Thanks, Udi Pasmon Yes, this is one of

Migrating from OpenID 2.0 to OpenID Connect

 ̄綄美尐妖づ 提交于 2019-12-06 10:49:33
As we know Google Login is migrating from OpenId2.0 to OpenId connect. I have changed my code as like require 'oauth/openid.php'; $openid = new LightOpenID; $openid->realm = "http://".$_SERVER[HTTP_HOST]; $openid->identity = 'https://www.google.com/accounts/o8/id'; $openid->required = array('contact/email'); if (!headers_sent()){ header('Location: '.$openid->authUrl()); }else{ echo '<script type="text/javascript">'; echo 'window.location.href="'.$openid->authUrl().'";'; echo '</script>'; } } But it is throwing an error like invalid parameters sent . Should I need to add/change anything? 来源:

OpenID Integration

落爺英雄遲暮 提交于 2019-12-06 09:00:50
问题 Does anyone know of an ASP.NET guide to implementing OpenID and what information can be returned by the OpenID provider? I understand you can get the email address but if someone logs in with their Google OpenID can you get access to their addresses? 回答1: Yes, OpenID Providers can and often do offer 'claims' or 'attributes' about the people logging in if the OpenID relying party requests them and the user consents to these data being shared. If you use DotNetOpenAuth for your ASP.NET OpenID

水煮鱼的wordpress+小程序做成的小论坛

ぃ、小莉子 提交于 2019-12-06 08:53:49
出售水煮鱼授权转卖的wordpress的小程序《小论坛》,300元一份。 只出售代码,不包括配置、申请小程序、部署小程序等操作维护,可以咨询,但不是义务。 需要的加我微信,请标注(购买小程序): 还不知道这个产品的同学,可以扫描下面的二维码看看 很多人问我有没有小程序 WordPress 插件啊,厄,其实我的小论坛小程序其实就是一个基础的 WordPress 小程序基础库。 所以我卖的是小论坛小程序, 其实还附送了一个基础的 WordPress 小程序基础库 ,你利用他可以做很多小程序开发,而且只要1000快。 今天就讲一下这个小程序基础库,文章略长,主要是为了 全方位展示我做的小程序插件很厉害很牛逼 。不看后悔,看了更后悔,因为你会后悔为什么没有早点下手购买,恩,就是这么自信。 好,下面开始了。。。 小程序设置 安装好插件之后,就可以看到小程序的后台管理菜单,这是小程序的所有基础功能: 点击第一个,小程序设置,可以让你输入 APPID 和 APP Secret, 输入之后,就会出现功能设置的 tab: 从这里可以看到小论坛只是这个小程序插件里面的一个功能,还有另外一个功能就是客服消息回复。 客服消息管理 小论坛后面再讲,开启客服消息回复之后,就会多出一个客服消息设置: 按照要求设置好之后,用户点击小程序客服按钮,发送消息,就能在后台接收到消息了: 你可以回复用户,文本,图片

JanRain OpenID in PHP SREG?

南楼画角 提交于 2019-12-06 08:53:00
问题 I setup the demo with a modified login I found called open-id selector. the login works fine and the identity url comes back, but the SREG data I ask for is never populated, required or optional. I am logging into my page with a gmail account. Here is the code from my try_auth.php that I edited $sreg_request = Auth_OpenID_SRegRequest::build( // Required array('email'), // Optional array('fullname', 'gender', 'timezone', 'dob', 'country')); what gives? 回答1: Google's OpenID identity provider

php websoket 通讯

百般思念 提交于 2019-12-06 08:08:09
server <?php /** * websorket 即时通讯服务器 */ class Websocket { private $_serv; private $_pdo; public function __construct($host='0.0.0.0',$port=9501) { $this->_serv=new swoole_websocket_server($host, $port, SWOOLE_BASE); $this->_pdo=new PDO("mysql:host=*********;dbname=leocms", "*****","*****"); //初始化一个PDO对象$this->_serv->set( ['websocket_compression' => true,] ); $this->_serv->on('handshake',[$this,'on_handshake']); $this->_serv->on('open',[$this,'on_open']); $this->_serv->on('message',[$this,'on_message']); $this->_serv->on('close',[$this,'on_close']); } /** * 退出登录 */ public function on_close

Authorization/Authentication with Google account in GWT

断了今生、忘了曾经 提交于 2019-12-06 07:54:00
I'm trying to enable my GWT application authenticate users with their Google accounts. What I basically need is just to have an unique value for every user and be sure that these values will always describe correct users. The main requirement is, the number of lines of code I have to write is as small as possible :-) I'm trying to use gwt-oauth2 library, but it looks like the whole idea of OAuth is to provide a token that allows access to different private resources like mail, contacts, etc., but it doesn't define the user itself. Question #1 - is that right that token Google gives me only

Using OpenID on a PhoneGap platform

别来无恙 提交于 2019-12-06 07:15:32
问题 I am currently developing an application using PhoneGap. My application used OpenID to authenticate a user. After successfully authenticate a user, it should be return back to my application. I have used location.href to redirect the page to a local address (something like file:///var/applications/.../index.html for iOS app). However, it seems that PhoneGap cannot redirect a local page from remote site. Only a white screen was displayed. Is there any way for me to return back to my