openid

微信公众号与APP微信第三方登录账号打通

社会主义新天地 提交于 2020-01-31 10:54:42
一个项目同时开发了APP和微信服务号,需要做到APP和微信服务号的账号互通同步,也就是说一个账号在2个地方都可以用,当然这个前提是保证你公司自己的服务器的数据库用的是同一套。 为保证用户数据的唯一性,打通app与公众号的数据,需要做如下工作: 1.申请appid, 在-登录微信开放平台--申请账号(如果没有,就去注册,不能使用公众号登录或注册)--开发者资质认证(账号中心,认证时需提交很多资料;等待认证结果)--认证通过之后,创建应用(管理中心,创建你要开发的app,等待审核);以上是app需要做的。(如果app与公众号共用一个用户数据库,则继续以下步骤:--绑定公众账号(管理中心--公众账号,有几个公众账号,就绑定几个)); 注意:公众号的数据和app的数据,一定要保证放在同一个服务端,不同的话,需要登录公众号,在网页授权的功能里,把授权的服务器地址改成与app的一样(很重要这一步) 2.app上第三方登录, 配置开发,网上有很多资料,可自查;主要在授权登录成功以后,将获取到的微信用户数据传送给后台(openid和unionid最主要,不同的公众号登录openid不同,但unionid是唯一的) 3.后台方面很重要 当用户进行公众号登录时,要根据获取的openid和access_token再获取详情信息(主要是unionid),当app客户端传过来的unionid,进行判断

微信网页授权java实现

江枫思渺然 提交于 2020-01-29 08:56:42
功能:主要用于在用户通过手机端微信访问第三方H5页面时 获取用户的身份信息(openId,昵称,头像,所在地等。。)可用来实现微信登录、微信账号绑定、用户身份鉴权等功能。 开发前的准备: 1、需要有一个公众号,拿到AppID和AppSecret; 2、进入公众号开发者中心页配置授权回调域名。具体位置:接口权限-网页服务-网页账号-网页授权获取用户基本信息-修改 注意,这里仅需填写全域名(如www.qq.com、www.baidu.com),勿加 http:// 等协议头及具体的地址字段; 这个域名需要是一个备案过的域名。这个条件比较难办,幸好热心的网友qydev为我们无私地提供了一个备案过的域名,我们可以通过使用Ngrok来虚拟一个域名映射到本地开发环境,简直是web开发神器啊。。 qydev版Ngrok使用说明及下载地址: http://www.qydev.com/ 本文以 lovebread.tunnel.qydev.com 域名为例: 3、如果嫌手机上测试麻烦,可以使用微信官方提供的web开发者工具直接在浏览器中进行调试。 前提是需要在微信公众号中绑定开发者账号:登录公众号-开发者工具-进入web开发者工具-绑定web开发者微信账号 使用说明及下载地址: https://mp.weixin.qq.com/wiki?action=doc&id=mp1455784140&t=0

小程序显示数据

廉价感情. 提交于 2020-01-29 04:41:30
1.当遍历是一条数据,取数据是个数据需要遍历,只需要取 base.y_slide进行遍历即可。 $base['y_slide'] = unserialize($base['y_slide']); $num = count($base['y_slide']); for($i = 0; $i < $num; $i++) { $base['y_slide'][$i]=$_W['attachurl'].$base['y_slide'][$i]; } 2.遍历的是多条数据 foreach ($item as &$values) { $values['k_slide'] = unserialize($values['k_slide']); $num = count($values['k_slide']); for ($i = 0; $i < $num ; $i++) { $values['k_slide'][$i]=$_W['attachurl'].$values['k_slide'][$i]; } } 3.传数据给下一个页面传id data-k_id='{{item.k_id}}' 点击事件 传id departmentDetailClick: function(e) { console.log(e.currentTarget.dataset.k_id) var k_id = e

Java实现微信网页授权

不问归期 提交于 2020-01-28 15:12:03
微信测试平台 : https://open.weixin.qq.com/connect/qrconnect?appid=wx39c379788eb1286a&scope=snsapi_login&redirect_uri=http%3A%2F%2Fmp.weixin.qq.com%2Fdebug%2Fcgi-bin%2Fsandbox%3Ft%3Dsandbox%2Flogin 开发前的准备: 1、需要有一个公众号(我这里用的测试号),拿到AppID和AppSecret; 2、进入公众号开发者中心页配置授权回调域名。具体位置:接口权限-网页服务-网页账号-网页授权获取用户基本信息-修改 注意,这里仅需填写全域名(如www.qq.com、www.baidu.com),勿加 http:// 等协议头及具体的地址字段;   我们可以通过使用Ngrok来虚拟一个域名映射到本地开发环境,网址https://www.ngrok.cc/,大家自己去下载学习怎么使用 同时还需要扫一下这个二维码 授权步骤: 1、引导用户进入授权页面同意授权,获取code 2、通过code换取网页授权access_token(与基础支持中的access_token不同) 3、通过网页授权access_token和openid获取用户基本信息 先看一下我的项目结构: web.xml相关代码: <?xml version

微信小程序获取登录手机号

风流意气都作罢 提交于 2020-01-27 05:40:04
小程序获取登录用户手机号。 因为需要用户主动触发才能发起获取手机号接口,所以该功能不由 API 来调用,需用 <button> 组件的点击来触发。 首先,放置一个 button 按钮,将 button 的 open-type 的属性值设为 getPhoneNumber 。 当用户点击并通过之后,通过绑定的事件获取微信服务器返回过来的加密数据,再根据 session_key 和 app_id 通过后台解密就可以获取手机号啦。 说到这,就上码吧!!! 1 <!--index.wxml--> 2 <view class="container"> 3 <view class="userinfo"> 4 <button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo"> 获取头像昵称 </button> 5 <block wx:else> 6 <image bindtap="bindViewTap" class="userinfo-avatar" src="{{userInfo.avatarUrl}}" mode="cover"></image> 7 <text class="userinfo-nickname">{{userInfo.nickName}}<

Retrieve openid bearer token using headless browser setup

混江龙づ霸主 提交于 2020-01-25 08:34:18
问题 Using OkHttp3 I was happily scraping a website for quite some time now. However, some components of the website have been upgraded and are now using an additional OpenID bearer authentication. I am 99.9% positive my requests are failing due to this bearer token because when I check with Chrome dev tools, I see the bearer token popping up only for these parts. Moreover, a couple of requests request are going to links that end with ".well-known/openid-configuration". In addition, when I

OpenID+OAuth for YouTube using openid4java

杀马特。学长 韩版系。学妹 提交于 2020-01-25 00:59:05
问题 My application allows users to log in using OpenID from Google or Yahoo. There's also a feature which allows users to upload to YouTube. Some users arrive via a YouTube context with the purpose of creating something and uploading to YouTube. These users will need to authorize my application to access both the address on their Google Account via OpenID, and their YouTube account via OAuth. I'd like this to be achieved with a single authorization click for the user. I've seen this done here:

Angularjs - Send authorization header in redirection with $window.open

半腔热情 提交于 2020-01-24 20:05:30
问题 As mentioned in the title, I want to perform a redirection from an angularJs application residing in localhost:port1 to another angularJs application in localhost:port2 . The two application are secured using openid-connect server and this angualrjs directive. The problem is when I'm logged in the first app and I perform a redirection to the second app, it tells me to re-sign in as if i'm not authenticated. So I've figured a workaroud for this problem: I sent the access_token in the redirect

Angularjs - Send authorization header in redirection with $window.open

十年热恋 提交于 2020-01-24 20:05:29
问题 As mentioned in the title, I want to perform a redirection from an angularJs application residing in localhost:port1 to another angularJs application in localhost:port2 . The two application are secured using openid-connect server and this angualrjs directive. The problem is when I'm logged in the first app and I perform a redirection to the second app, it tells me to re-sign in as if i'm not authenticated. So I've figured a workaroud for this problem: I sent the access_token in the redirect

IdentityServer Facebook Auth changes subject id / is not the facebook id

回眸只為那壹抹淺笑 提交于 2020-01-24 19:30:26
问题 I enabled the IdentityServer to authenticate with Facebook with the implicit flow. now when I get authenticated i get an id value as subject. like 502967fe0125ce3ff75050ef7b83fd68 I used it as a user id to store user related data. But from time to time it seems like the content of the subject changes and I get a different id. Am I missunderstanding the concept of the Subject . Is it expected that it is chagning ? Shouldn't be the subject id constant? What information should I use to store