jpahullo/moodle-tool_mergeusers

O365 error login

AngelVillalbaQ opened this issue · 1 comments

I have had login problems when merging 2 oidc accounts, the merge is done without any problem but the account that keeps the data cannot login, it shows an error.

Error code: errorauthunknownstate moodle
line 204 of /auth/oidc/classes/loginflow/authcode.php: moodle_exception thrown

Hi @AngelVillalbaQ ,

This plugin auth_oidc is not a core plugin, so that you need to analyse plugin tables to see which fields are related to user.id and define your own settings on mergeusers/config/config.local.php, similar to what we provide in https://github.com/jpahullo/moodle-tool_mergeusers/blob/master/config/config.php#L57, like:

<?php
defined("MOODLE_INTERNAL") || die();

/**
 * Custom settings.
 */
return [
    // If some index exists involving some field related to core user.id field.
    'compoundindexes' => [
        'oidctablename' => [
            'userfields' => ['userfieldname'],
            'otherfields' => ['otherfieldname'],
        ],
    ],
    // If some table has some field related to core user.id field and has some specific name, not standard as you can see on:
    // https://github.com/jpahullo/moodle-tool_mergeusers/blob/master/config/config.php#L153
    'userfieldnames' => [
        'oidctablename' => ['userfieldname1', 'userfieldname2'],
    ],
];

Thanks for the feedback.

Let me know how it goes.

Jordi