Unique Slug Generation in Strapi V4

It is impossible to generate a unique slug for the same string.

I have been using Strapi since v3 and it worked perfectly there. I started with the same thought that the username for my each user would be unique. But turns out when using social providers such as google login, this fails and I can have multiple people with the same username.

So I turned to a slug based system slug connected to name of the person.
I am using REST API to add content and Strapi surprised me again by not returning the slug generated via API (even though I can see it in the Dashboard).

So I turned to strapi-plugin-slugify. This plugin too can not help with unique generation of slug for same name (even with slugifyWithCount set to true).

I am finding it incredibly difficult to make a slug system work in Strapi v4. All of this worked seamlessly in Strapi v3. I had to resort to an ugly slug system where the slug is a random string generated by frontend.

Can anyone please point me in the right direction? I may be wrong as it shouldn’t be this tough to make a unique slug for the name of the users. Any help is appreciated!

System Information
  • Strapi Version: 4.3.8
  • Operating System: Ubuntu 22.04
  • Database: SQLite
  • Node Version: v16.0.0
  • NPM Version: 7.10.0
  • Yarn Version: 1.22.15

I had to resort to a very bad solution.
I am now generating slugs on frontend, checking them if they exist on Strapi and regenerating it again if it does and again checking. The first name is used to generated a slug followed by a digit depending on the result returned by checking. It’s a very bad setup. Wish Strapi’s system for unique slug/username generation wasn’t this broken. Surprisingly it all worked in the previous version.