Support » Plugin: Login by Auth0 » Custom database – migration fro 3.10 to 3.11

  • Resolved mmki

    (@mmki)


    I’ve been testing upgrade from 3.10 to 3.11 version.
    I have custom database.

    1) Do I have to update wordpress database manually to adjust wp_auth0_id and wp_auth0_obj in wp_usermeta data to use namespaces?
    2) Am I right that Account-Linking-Do-Not-Rename- Rule in Auth0 dashboard is no longer useful?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Josh C

    (@auth0josh)

    Hi @mmki!

    1) If you want to add a namespace to an existing site, you’ll need to adjust both the Auth0 user and the WordPress user. We have some documentation on the Auth0 process here. In WordPress, you can either delete the Auth0 data for all users (will be re-created on login) using this method or you can search/replace in those fields to add it.

    2) That rule should still work fine, it’s just no longer able to be turned off or on in the WordPress admin. You can also use the Auth0 Account Link Extension.

    Thread Starter mmki

    (@mmki)

    Hi,
    I have problem with migrating my users. Due to conferences season I couldn’t do it earlier.

    I have to update my WP from 3.10 to 3.11.1 and change my users user_id’s from something like auth0|123 to auth0|accounts-migration|123

    I have custom database which is my WP database.

    I’m testing the migration process. I do the following steps:

    Prerequirements:

    • I have WP instance similar to my production environment.
    • I have connection for testing purposes created in Auth0 dashboard and configured to use my wordpress database as a custom database.
    • I install Auth0 3.10.
    • I create some new users in my wordpress. I perform a login with theese acccounts to connect them to Auth0 auth0.

    Then I use Auth0’s import/Export Extension. I export all the users with all their attributes that i see in RAW JSON view.
    I create new connection in Auth0 and configure it like the old one except one line on login and get user scripts.

    I change:
    user_id: wpUser.data.ID,
    to:
    user_id: configuration.userNamespace + '|' + wpUser.data.ID,

    I also add the configuration:

    • set the correct migrationToken
    • set userNamespace to accounts-migration
    • set correct endpointUrl

    I adjust previously exported json file:

    • Add brackets [] at the beginning and at the end.
    • Add semicolons , at the end of each line.
    • Change User IDs from something like auth0|123 to accounts-migration|123 and from 123 to accounts-migration|123
    • change connection data
    1. I turn the new connection on and the old connection off for my application.
    2. I import data to my new connection.
    3. I execute some SQL queries to change wp_auth0_id and wp_auth0_obj in wp_usermeta table accordingly.
    4. I change connection in WP > Auth0 > Settings > Features > Auto Login Method to my new connection.
    5. I test my new connection scripts in Auth0 – everything is fine.
    6. I Upgrade WP Login by Auth0 plugin to 3.11.1

    The problem is that my old accounts cannot log in. I can go to wp as an admin and change their passwords and everything is fine.
    I can also add new accounts and successfully connect them to auth0.

    The problem is that I need to migrate my old users with their metadata and I don’t want to tell users that they have to change their passwords.
    Is there something I’m missing? What is wrong that users can’t use their old passwords?

    My old user – RAW JSON:

    
    {
        "email": "f3@bar.com",
        "email_verified": true,
        "nickname": "f3",
        "name": "f3@bar.com",
        "picture": "https://s.gravatar.com/avatar/63ffa3fc3c44486161ee65306faca814?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Ff3.png",
        "user_metadata": {},
        "created_at": "2019-10-04T13:06:27.462Z",
        "updated_at": "2019-10-04T13:06:27.462Z",
        "identities": [
            {
                "provider": "auth0",
                "connection": "ACCOUNTS-DEVELOPMENT",
                "isSocial": false,
                "user_id": "5009"
            }
        ],
        "user_id": "auth0|5009",
        "blocked_for": [],
        "guardian_authenticators": []
    }
    

    My migrated user – RAW JSON

    
    {
        "email": "f3@bar.com",
        "email_verified": true,
        "nickname": "f3",
        "name": "f3@bar.com",
        "picture": "https://s.gravatar.com/avatar/63ffa3fc3c44486161ee65306faca814?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Ff3.png",
        "user_metadata": {},
        "created_at": "2019-10-04T12:51:54.404Z",
        "updated_at": "2019-10-04T12:51:54.404Z",
        "identities": [
            {
                "provider": "auth0",
                "connection": "ACCOUNTS-MIGRATION",
                "isSocial": false,
                "user_id": "accounts-migration|5009"
            }
        ],
        "user_id": "auth0|accounts-migration|5009",
        "blocked_for": [],
        "guardian_authenticators": []
    }
    

    wp_auth0_id new:

    
    auth0|accounts-migration|5009
    

    wp_auth0_obj new:

    
    {"created_at":"2019-10-01T11:27:09.680Z","email":"f3@bar.com","email_verified":true,"identities":[{"user_id":"accounts-migration|5009","provider":"auth0","connection":"ACCOUNTS-MIGRATION","isSocial":false}],"name":"f3@bar.com","nickname":"f3","picture":"https:\/\/s.gravatar.com\/avatar\/63ffa3fc3c44486161ee65306faca814?s=480&r=pg&d=https%3A%2F%2Fcdn.auth0.com%2Favatars%2Ff3.png","updated_at":"2019-10-04T08:21:27.669Z","user_id":"auth0|accounts-migration|5009","last_ip":"94.246.128.25","last_login":"2019-10-04T08:21:27.669Z","logins_count":2,"sub":"auth0|accounts-migration|5009"}
    
    • This reply was modified 1 year, 4 months ago by mmki.
    • This reply was modified 1 year, 4 months ago by mmki.
    • This reply was modified 1 year, 4 months ago by mmki.
    Plugin Contributor Josh C

    (@auth0josh)

    @mmki – Apologies for the delay here, there is a lot of information to parse in this post.

    I don’t know that I’m able to walk through this step-by-step and see where the process went wrong. To use the same password, the Auth0 user record needs to be the same. Looking at the old and new users, that appears to be the right structure.

    When you say “they’re not able to log in,” what does that mean? Are they getting an error on the Auth0 login form or on the WP application when they return?

    We have a number of troubleshooting steps at the bottom of this page that might be helpful:

    https://auth0.com/docs/cms/wordpress/user-migration#troubleshooting

    Thread Starter mmki

    (@mmki)

    In Auth0 logs I have:

    Type
    Failed Login (wrong password)
    Description
    Wrong email or password

    .

    The same is on ULP form.
    When I try the login script I get the right profile, so there must be some error/misconfiguration (?) elsewhere.

    Plugin Contributor Josh C

    (@auth0josh)

    Do you have “Import Users to Auth0” turned on for the database Connection that you’re using? That’s under the Settings tab for the Connection in the Auth0 dashboard. If so, is this user already in the database? If that’s the case, then you are authenticating against the Auth0 user after the first login, not WordPress. With that import setting on (which is the default if you used the setup wizard), users are added to the Auth0 DB when they first log in and every subsequent login after that happens in Auth0, not WordPress. Since you can’t export passwords from Auth0 and import them back in, they’ll need to reset their password via Auth0 or WordPress.

    Thread Starter mmki

    (@mmki)

    Hi Josh. Thank you for the explanation, it was very helpful. I didn’t realize that passwords weren’t migrated with other data.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Custom database – migration fro 3.10 to 3.11’ is closed to new replies.