Mobile Application : login blocked due to authorization request

(Pierre Grand) #1

I cannot use the mobile application to connect to my site
I get this message when trying to log in:

Like the first time I’m connecting to

But if I click “authorize”, then for it’s working, on my forum it’s never working, I get this message:

Does anyone already encountered this issue?
I didn’t notice this when the site was not HTTPS. Maybe there could be a link by some way…

Here is the error log title:
Failed to handle exception in exception app middleware : PG::UniqueViolation: ERROR: duplicate key value violates unique constraint “index_user_api_keys_on_client_id”

not sure I can share safely the details of the log.

My phone is a BQ AQUARIS X PRO
Android : 8.1.0
The same issue appears also on SAMSUNG S8 and IPHONE 5 iOS 10.3.3

(Jeff Atwood) #2

What version of Discourse are you on? Be sure to update to latest.

(Sam Saffron) #3

Appears to be running 2.0.0.beta4 per: IOS Community Discussion Forum so I suspect something else is at play.

What plugins do you have installed @Pierre_GRAND are there any errors in logs: Where are all the Discourse logs

(Pierre Grand) #4

hello, it’s true that my forum is in the last beta version.
No plugin installed.
will have a look more in detail in the logs, thanks for this sharing Sam.
For now I just verified the GUI log and found this message:

Failed to handle exception in exception app middleware : PG::UniqueViolation: ERROR: duplicate key value violates unique constraint “index_user_api_keys_on_client_id”

(Sam Saffron) #5

Hmmm, can you go to your user page and revoke all the user api keys you have and try again?

(Pierre Grand) #6

Hi Sam, sorry not sure to follow you.
I went to the User settings but didn’t find any API related function.
I went to he API tab in settings but there is no key generated.

There must be something I’m missing in the basic conf.
In all the discourse forum I’m using on my mobile only mine is behaving like this.

I manage to connect to the forum through the app in the end but I get disconnected when I leave the app.
Whereas all the other forums(meta.discourse, ubuntu) stay connected…
Could it be linked to single sign on feature?
I’m not using any SSO for mine.

(Pierre Grand) #7

I tried to generate a key for all user, didn’t change a thing for now.
will deep dive in log now, but I’m not sure what I’m looking for…

(Pierre Grand) #8

I noticed a strange behavior that might give some hint on the issue.
I have a dev instance of the forum on which in the past I validated the domain name and https deployment with let’s encrypt.
when setting up the dev in Discourse mobile app using the server hostname, I can see the redirection toward the https of my production environment.

Could there be some remaining forward on the dev server that redirect from dev to prod?(I re run the discourse setup with let’s encrypt set at “OFF”)
Could that affect the prod login?

(Judah) #9

I’ve had the same issue for a long time now for my own forum with the mobile login. I think I noticed it first happening when I switched SSO providers and the external ids were changed when I logged in again. It could have been be because I reused some of the same usernames but made new accounts with different emails but I always changed it before making another and there are none conflicting now.

The error log always says
ActiveRecord::RecordNotUnique (PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_user_api_keys_on_client_id" DETAIL: Key (client_id)=(

(Pierre Grand) #10

on my side I solved the issue simply by cleaning the browser cahce of my client. The change of hostname and domain name of the server was not integrated in a proper way in the client.
Sorry for the late feedback.

(David Taylor) #11

This topic was automatically closed after 33 hours. New replies are no longer allowed.