Product-apim: Able to login to devportal but not into publisher

Created on 6 Feb 2020  ·  8Comments  ·  Source: wso2/product-apim

when I try logging into publisher (https://localhost:9443/publisher), I get an -

invalid_client

Cannot find an application associated with the given consumer key : undefined

Have no problem logging into devportal.

Can anyone suggest what could the reason be.

Thanks

TypQuestion

Most helpful comment

I've also ran into a similiar problem. For me this problem overlapped with #7254. This took quite some time to figure out and fix.

The errors I encountered are as follows:

In /devportal/ login page I've seen:

  • Error message invalid_client: Cannot find an application associated with the given consumer key: ...
  • A red error message box saying an unexpected error occured
  • After login page a blank white page appears with an HTTP status code 500

In api-manager docker container I've seen:

  • ERROR - DefaultRequestCoordinator Context does not exist. Probably due to invalidated cache.
  • ERROR - WebAppManager org.mozilla.javascript.EcmaError: TypeError: Cannot read property "length" from undefined (/publisher/services/login/login_callback.jag#53)

The reason seems to be that under Carbon => Service Providers => admin_admin_store => Edit => Inbound Authentication Configuration => OAuth/OpenID Connect Configuration the attributes client_secret and/or client_id changed.

The solution was to do the following:

  • Check this SQL SELECT * FROM public.am_system_apps; and confirm that client_secret and/or client_id is correct. If not, set these values to ones seen in the Carbon admin_admin_store service provider page.
  • Check this SQL SELECT * FROM public.idn_oauth_consumer_apps; and confirm that client_secret and/or client_id is correct. If not, set these values to ones seen in the Carbon admin_admin_store service provider page.
  • I was using Postgres and had to clean database cache (or something to that extent) using VACUUM (FULL) wso2;
  • Then go to developer portal, remove all cookies, local storage data, etc.
  • Try to log in now and it should work

Suffice it to say - this is an insane amount of work to do just because you clicked Regenerate secret in an admin panel... And what's worse is that supposedly I had to know not to click that button. And even worse - this seems to be undocumented (or maybe I didn't find this in docs).

All 8 comments

@kharsha64
Can you try with a private browser and check?

@Krishanx92
Hi,
I tried that as well but am getting the same error for the publisher.

Thanks

Hi @kharsha64 ,
Have you deleted the SP application created using management console. Ex: admin_apim_publisher default SP app.

Screenshot 2020-02-10 at 10 04 43

The error "Cannot find an application associated with the given consumer key : undefined" might occur due to above issue and also for trying out an old cached consumer key. Therefore, also try to clean the cache in the browser before trying out.

Hi,
No, I haven't deleted any SP. Am using the default SPs that come with the application.
Have tried clearing the browser cache and also tried it with different browsers.
But in vain. Same error.

Thanks

Hi login to the carbon console and go to service providers and click edit in "admin_publisher" and expand Inbound Authentication Configuration -> OAuth/OpenID Connect Configuration.
Screenshot 2020-02-11 at 10 21 50

Then check the client ID of the SP OAuth App against the CLIENT_ID cookie in the browser.
Screenshot 2020-02-11 at 10 20 21

If the both are same then the above issue shouldn't occur, if they are different try removing cookies in the browser and login to the publisher again.

Hi,
I noticed that the CLIENT_ID cookie is coming as undefined.
Cleared the cookie and tried again.
But the CLIENT_ID comes back as undefined.

Hi @CrowleyRajapakse
I removed the publisher service provider and after that I imported service provider.
Now the consumer key in Carbon differs from the one existing in the cookie. So, I removed the cookie and tried to load publisher page but it loads

Cannot find an application associated with the given consumer key :  ***old consumer key***

And that's because in the cookie the old consumer key appears.

Please help, me to fix this problem.

I've also ran into a similiar problem. For me this problem overlapped with #7254. This took quite some time to figure out and fix.

The errors I encountered are as follows:

In /devportal/ login page I've seen:

  • Error message invalid_client: Cannot find an application associated with the given consumer key: ...
  • A red error message box saying an unexpected error occured
  • After login page a blank white page appears with an HTTP status code 500

In api-manager docker container I've seen:

  • ERROR - DefaultRequestCoordinator Context does not exist. Probably due to invalidated cache.
  • ERROR - WebAppManager org.mozilla.javascript.EcmaError: TypeError: Cannot read property "length" from undefined (/publisher/services/login/login_callback.jag#53)

The reason seems to be that under Carbon => Service Providers => admin_admin_store => Edit => Inbound Authentication Configuration => OAuth/OpenID Connect Configuration the attributes client_secret and/or client_id changed.

The solution was to do the following:

  • Check this SQL SELECT * FROM public.am_system_apps; and confirm that client_secret and/or client_id is correct. If not, set these values to ones seen in the Carbon admin_admin_store service provider page.
  • Check this SQL SELECT * FROM public.idn_oauth_consumer_apps; and confirm that client_secret and/or client_id is correct. If not, set these values to ones seen in the Carbon admin_admin_store service provider page.
  • I was using Postgres and had to clean database cache (or something to that extent) using VACUUM (FULL) wso2;
  • Then go to developer portal, remove all cookies, local storage data, etc.
  • Try to log in now and it should work

Suffice it to say - this is an insane amount of work to do just because you clicked Regenerate secret in an admin panel... And what's worse is that supposedly I had to know not to click that button. And even worse - this seems to be undocumented (or maybe I didn't find this in docs).

Was this page helpful?
0 / 5 - 0 ratings