Block users on bulk creation

Hello,

I’m trying to create new users in bulk with the “blocked” flag set to true. The API doesn’t seem to allow that, for which I don’t see any reason why, so I’m trying to work around that.
I can’t find any way other than updating each user individually. This seems very inefficient at best, does anyone see a better way ?
Would the Auth0 people be ready to change the bulk API to accept this flag ?

Thanks.

@marsup I’ve not tried to block a user during import, but I am a bit surprised you cannot set “blocked” flag. Since that isn’t working for you a quick workaround idea is to set a property in app_metadata. Then via a rule you could do something like this:

if (user.app_metadata.blocked) {
  // Optionally call the management api to block the user
  // If doing optional step above: Delete the blocked flag from app_metadata and save.
  // Do this to prevent the user from accessing the application.
  return new Callback(new UnauthorizedError('This account is blocked.");


}

This won’t give you the same behavior as the native Auth0 blocked user, but it would be a way to work around this constraint. This can be kind of a pain though, because you’d have to check two places when unblocking a user.

On that note I am happy to submit a feature request with the product team, but it is unlikely to have fast turn around time. You can also post feature requests in Auth0 Community under:

http://community.auth0.com/c/feature-request

Well, the flag is not denied per se but the documentation doesn’t mention its support and adding it doesn’t have any effect so I’m guessing it’s just ignored.

It looks more like a bug than a feature request to me, all the fields create or update support should be supported by import, I don’t see why not. Would it be taking a slightly faster path if you submitted that yourself ? :stuck_out_tongue:

Thanks for your answer.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.