Skip to main content

User Management with Auth0

Tonight I wanted to write about my current journey with moving our user identity management provider (which shall rename nameless), over to Auth0.  I would like to talk about the pitfalls and triumphs as we go.  It's mostly all good - a shame we hadn't done so sooner!

Now one of the most attractive attributes is the different methods/connectors that are provided in order to easily integrate your existing system, and I mean they cover just about everything, but this is also a segway to my first - very little - bit of criticism.  From what I see there are two main channels to provide some type of form to present to your user to input their credentials.  By the way, I'm still learning so please feel free to say I'm wrong at any stage.
  1. Lock / Universal Login 
  2. Hosted Pages
There is a mention of a "custom" way to work with Lock, but the customization looks little to be desired.  As to the hosted pages, well, again - correct me if I'm wrong - but it looks like the form being hosted has to contain the whole DOM, and if I'm going to make changes to my site's general template, I don't want to have to come back in here and do separate alterations.

I should also give a quick callout for the plugin they have developed for WordPress: Login by Auth0.  I've done some intial testing, and it works very well, and with all the functionality WordPress gives you, I understand you would just need to use its existing methods to login and create forms around.  Maybe it's just a bad name, but this got me to thinking how I would effectively create users as well using it.

But I digress, for me, I just want to tap in to the API's directly and build the form myself in our own environment - so for our migration, I am using the JS SDK (v9).  I've overcome a few hurdles, one of the most confusing aspects is the cross terminology from one type of API call to another.

For instance, take this example from this documentation, covering the use of the userinfo API. After the user has signed in, and they are given an access code, this is the same code you would use in place of the header: Authorization: Bearer {ACCESS_TOKEN}.

However, don't let this confuse you with that if you wanted to do something like a "user search", or "link accounts" etc.  This is done with the Auth0 Mangement API.  You'll also notice that unlike API's such as userinfo, where the URL is structured like: https://YOUR_DOMAIN/userinfo, the management API uses the format of https://YOUR_DOMAIN/api/v2/....

This management API uses a separate retrieval of an access token, which you can follow this guide on how to retrieve it.

Hopefully this has given some extra food for thought, and I'm sure this won't be the last I write on this subject. Nitty-picking at things aside, I'm very excited our team has collectively decided to use this platform.  It's tailored directly for devs!

Comments

Popular posts from this blog

question2answer Wordpress Integration

 Today I want to journal my implementation of a WordPress site with the package of "question2answer".  It comes as self-promoted as being able to integrate with WordPress "out of the box".  I'm going to vent a small amount of frustration here, because the only integration going on is the simplicity of configuration with using the same database, along with the user authentication of WordPress.  Otherwise they run as two separate sites/themes. This will not do. So let's get to some context.  I have a new hobby project in mind which requires a open source stack-overflow clone.  Enter question2answer .  Now I don't want to come across as completely ungrateful, this package - while old, ticks all the boxes and looks like it was well maintained, but I need every  page to look the same to have a seamless integration.  So, let's go through this step by step. Forum Index Update This step probably  doesn't need to be done, but I just wanted to make sure th

Machine Learning: Teaching Wisdom of the Crowd

I got lost in an absolute myriad of thoughts the other day, and it essentially wound up wondering if we can teach machines to count, beyond of what it can see in an image, and I've come up with a small experiment that I would absolutely love to collaborate on if anyone (@ Google ?) else is interested. The idea is based on  the concept of the experiments performed using " Wisdom of the Crowd ", commonly in this experiment to use a jar of jelly beans and asking many people to make a guess as to how many is in there.  Machine learning can be used to make predictions from patterns, but it would have nothing to gain looking at one picture of a jelly bean jar to the next and being able to correctly identify that is in fact - a jar of jelly beans. But suppose we feed it several images of jars of jelly beans, along with all of the guesses people have made of how many is in there.  Can we then presume that feeding it a new image, it would be able to give us a fairly accurate c

WooCommerce: Controlling an Asset CDN

Continuing on from my last post , I faced a new issue when it came to adding products and the associated images I was putting in (from Cloudinary ) was getting uploaded to the WordPress media library. Not only that, using the URL from my site instead of the CDN it had come from. Double up on all of my images, what a waste - and I want to host from the CDN to keep costs of bandwidth down.  So let me show you how I overcame it. Separating the herd What was interesting, is that it was keeping a record of the original source location, and I found I could filter these apart from the rest of my media library: With this in mind, I wrote a function around it so I could use it to give me a true/false if the given attachment was from this source. Attaching the hook Next, needed a way that as soon as an image was added, that it would update the attachment (post) pointing to the correct reference, and not to the file on our server. I found the add_attachment hook, which fires only whe