Can't add forum in Discourse IOS/Android apps to not admin

AI-generated summary

Users cimpleodev and ffhaddad report an issue where non-admin users cannot add their Discourse forum in the iOS/Android apps due to a blank page after clicking “Authorize” — despite having API keys and proper trust levels. Both encounter the same PostgreSQL error: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_user_api_keys_on_client_id". This issue surfaced after restoring a backup on a new server for ffhaddad. sam suggests uninstalling and reinstalling the app as a temporary workaround, and later sam confirms the root cause was likely fixed in a recent update. The problem appears to stem from a duplicate client_id in the user_api_keys table, preventing non-admins from completing the OAuth flow in the mobile app. Admin accounts work normally, suggesting a permissions or key collision issue specific to non-admin API key generation or assignment. No configuration change is mentioned as a fix — only the app reinstall workaround or waiting for the upstream patch.

Hi!
We have drupal site that in bound with discourse forum (sso). Trying to subscribe to our forum from Discourse IOS app (and android too) - add forum in app, proceed to authorize api page, and It can be posible only if we on admin account. New account, moderator account, user with generated API key by admin - just a blank page after login and push Authorize button. Admin account - Discourse app works and authorize normally on IOS and Android.

After a few tests we found this error in logs:
ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_user_api_keys_on_client_id" DETAIL: Key (client_id)=(7d5ed11e90a03cc28c91b96b3f231129

Min trust level for user api - 0,
Allow user api keys - checked.

Can you plese help with this? Maybe we need to config some user access?

I’m having a similar problem:

PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_user_api_keys_on_client_id" DETAIL: Key

Started after I restored a backup of my Discourse site on a new server.

Simplest workaround is uninstalling and installing the app

I am pretty sure I fixed the root cause of the issue a few weeks ago