Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

无法使用第三方登录 #323

Closed
Codefor4learn opened this issue Jul 20, 2023 · 5 comments
Closed

无法使用第三方登录 #323

Codefor4learn opened this issue Jul 20, 2023 · 5 comments

Comments

@Codefor4learn
Copy link

  • 主题版本号:最新版
  • WordPress版本:6.0.2
  • PHP版本:[选填]
  • 问题阐述:

无法使用第三方登录,点击登录会跳转到空白,我自己尝试了几天没结果,求助大佬看看

我的网站地址:https://www.amjun.com/

设置如下:

image
image

@Codefor4learn Codefor4learn added the 待确认问题 等待确认是否是已存在的问题 label Jul 20, 2023
@esotericman
Copy link

同样的问题,直接空白页,没有拉起Github认证,我是5.9版本

@Codefor4learn
Copy link
Author

确实不清楚是什么情况,看了下代码不清楚为什么不跳转授权页面

@esotericman
Copy link

修改oauth.php文件貌似可以修复
主要是添加了exit()以及替换wp_die()

//授权返回页面回调
function oauth_redirect_page($success = true, $info = '', $from_redirect = '')
{
    if ($success) {
        if (empty($from_redirect)) {
            wp_redirect(get_admin_url());
        } else {
            wp_redirect($from_redirect);
        }
    } else {
        pk_session_call(function () use ($info) {
            $_SESSION['error_info'] = $info;
        });
        wp_redirect(PUOCK_ABS_URI . '/error.php');
    }
	exit();
}
// 第三方授权登录开始跳转
function pk_oauth_start_redirect()
{
    $type = $_GET['type'];
    $redirect = $_GET['redirect'];
    $oauth = pk_oauth_get_base($type, $redirect);
    if (!$oauth) {
        oauth_redirect_page(false, '不支持的第三方授权请求', $redirect);
        wp_die();
    }
    $url = $oauth->base->getAuthUrl();
    if (!empty($url)) {
        pk_session_call(function () use ($oauth, $type) {
            $_SESSION['oauth_state_' . $type] = $oauth->base->state;
        });
        if(wp_redirect($url)){
		   exit();
		}
    } else {
	  wp_die();
	}
}

这个也要改了,不然打开快捷登陆后同时开启关闭第三方登录直接注册也会空白😂

 //不存在用户,先自动注册再登录
if (pk_is_checked('oauth_close_register')) {
    oauth_redirect_page(false, '您的' . $oauth->oauth['label'] . '账号未绑定本站账户,当前已关闭自动注册,请手动注册后再进入个人资料中进行绑定', $redirect);
     exit();
 }

没写过php,貌似是exit()没有写的问题或者wp_die()表现问题🤔

@hausen1012
Copy link

似乎确实是这样!!感谢

@Licoy Licoy added 已解决 and removed 待确认问题 等待确认是否是已存在的问题 labels Jan 23, 2024
Licoy added a commit that referenced this issue Jan 23, 2024
@Licoy Licoy closed this as completed Jan 23, 2024
@hausen1012
Copy link

并没有修复,建议作者再试试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants