其它语言如jsp等调用UCenter的同步登录接口

今天给一个站长处理jsp调用UCenter的同步登录接口,一直不返回Discuz!的值,只有其它的应用的,经过排查,该站长用的是Discuz!7.2版本,UCenter版本为1.5,control/user.php脚本里,

function onsynlogin() {
		$this->init_input();
		$uid = $this->input('uid');
		if($this->app['synlogin']) {
			if($this->user = $_ENV['user']->get_user_by_uid($uid)) {
				$synstr = '';
				foreach($this->cache['apps'] as $appid => $app) {
					if($app['synlogin'] && $app['appid'] != $this->app['appid']) {
						$synstr .= '<script type="text/javascript" src="'.$app['url'].'/api/'.$app['apifilename'].'?time='.$this->time.'&code='.urlencode($this->authcode('action=synlogin&username='.$this->user['username'].'&uid='.$this->user['uid'].'&password='.$this->user['password']."&time=".$this->time, 'ENCODE', $app['authkey'])).'" reload="1"></script>';
					}
				}
				return $synstr;
			}
		}
		return '';
	}

if($app[‘synlogin’] && $app[‘appid’] != $this->app[‘appid’])做了判断,即调用的appid相同的的话,不会有返回值,UCenter1.6.0版本已经去掉了&& $app[‘appid’] != $this->app[‘appid’]这个条件,去掉后,就能得到对应应用的返回值了。

Comments

No comments yet. Why don’t you start the discussion?

发表回复