Skip to content

Custom Oauth login Error and Solution #193

@dbnschools

Description

@dbnschools

Scenario to reproduce: Add custom Oauth and use Google as SSO. Limit to only your domain for login. When a user is signed into another google account other that your domain the Authorizer plugin produces this error and fatally crashes your site:

Error Details

An error of type E_ERROR was caused in line 2033 of the file /var/www/html/wp-content/plugins/authorizer/src/authorizer/class-authentication.php. Error message: Uncaught ArgumentCountError: Too few arguments to function Authorizer\Authentication::custom_logout(), 0 passed in /var/www/html/wp-content/plugins/authorizer/src/authorizer/class-authentication.php on line 903 and exactly 1 expected in /var/www/html/wp-content/plugins/authorizer/src/authorizer/class-authentication.php:2033

Stack trace:
#0 /var/www/html/wp-content/plugins/authorizer/src/authorizer/class-authentication.php(903): Authorizer\Authentication->custom_logout()
#1 /var/www/html/wp-content/plugins/authorizer/src/authorizer/class-authentication.php(149): Authorizer\Authentication->custom_authenticate_oauth2()
#2 /var/www/html/wp-includes/class-wp-hook.php(341): Authorizer\Authentication->custom_authenticate()
#3 /var/www/html/wp-includes/plugin.php(205): WP_Hook->apply_filters()
#4 /var/www/html/wp-includes/pluggable.php(702): apply_filters()
#5 /var/www/html/wp-includes/user.php(109): wp_authenticate()
#6 /var/www/html/wp-login.php(1323): wp_signon()
#7 {main}
thrown

Solution:
/var/www/html/wp-content/plugins/authorizer/src/authorizer/class-authentication.php
Line 2033 change
public function custom_logout( $user_id ) {
to
public function custom_logout( $user_id = 0 ) {

This solved the critical error for us immediately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions