conwetlab / ckanext-oauth2

OAuth2 support for CKAN
GNU Affero General Public License v3.0
25 stars 56 forks source link

Unable to create account after oauth login success #33

Closed ghn closed 5 years ago

ghn commented 5 years ago

Hi,

After login on my oauth provider, The return url is unable to create the user and the following error appears.

This is my return url http://localhost:5000/oauth2/callback?code=874crw6o1zsq9viytna0usuttp9htvy2gasc8ny0&state=eyJjYW1lX2Zyb20iOiAiL2Rhc2hib2FyZCJ9

but it's directly redirected to "http://localhost:5000/" with error:

None: Max retries exceeded with url: /oauth/token (Caused by None)

Any idea what's causing this problem?

This is the only log I could get

ckan_ckan | 2019-10-18 11:16:02,180 DEBUG [ckanext.oauth2.plugin] identify ckan_ckan | 2019-10-18 11:16:02,181 WARNI [ckanext.oauth2.plugin] The user is not currently logged... ckan_ckan | 2019-10-18 11:16:02,206 DEBUG [ckanext.oauth2.controller] login ckan_ckan | 2019-10-18 11:16:02,208 DEBUG [ckanext.oauth2.oauth2] Challenge: Redirecting challenge to page http://localhost:8080/oauth/authorize?response_type=code&client_id=oauth_client_id&redirect_uri=http%3A%2F%2Flocalhost%3A5000%2Foauth2%2Fcallback&state=eyJjYW1lX2Zyb20iOiAiL2Rhc2hib2FyZCJ9 ckan_ckan | 2019-10-18 11:16:02,209 INFO [ckan.lib.base] /user/login render time 0.032 seconds ckan_ckan | 2019-10-18 11:16:04,808 DEBUG [ckanext.oauth2.plugin] identify ckan_ckan | 2019-10-18 11:16:04,808 WARNI [ckanext.oauth2.plugin] The user is not currently logged... ckan_ckan | 2019-10-18 11:16:04,828 INFO [ckan.lib.base] /oauth2/callback render time 0.023 seconds ckan_ckan | 2019-10-18 11:16:04,854 DEBUG [ckanext.oauth2.plugin] identify ckan_ckan | 2019-10-18 11:16:04,855 WARNI [ckanext.oauth2.plugin] The user is not currently logged... ckan_ckan | 2019-10-18 11:16:05,143 DEBUG [ckanext.oauth2.plugin] identify ckan_ckan | 2019-10-18 11:16:05,143 WARNI [ckanext.oauth2.plugin] The user is not currently logged...

fdelavega commented 5 years ago

Can you share the CKAN configuration? Are you using Docker?

ghn commented 5 years ago

Hello, latest news: I managed to make it work. Yes I use docker for CKAN along with OAuth server.

my oauth server was accessible on localhost:8080 BUT CKAN has no clue of this url when it comes to CURL the oauth server to get the access_token. I changed the token_endpoint to http://oauth_server/oauth/token and profile_api_url to http://oauth_server/oauth/me in the configuration .ini file.

those 2 urls are service names in my docker-compose.yml! Not that ckan docker must be on the same network with oauth_server service.

Had a hard time figuring this out.

sanamart commented 3 years ago

Hello,

i am facing almost the same problem. After i login on my oauth provider (keycloak), i am being redirected to "http://localhost:5000/" with error:

None: Max retries exceeded with url: /auth/realms/master/protocol/openid-connect/token (Caused by None)

I did not completely understand what you changed. Is it the production.ini file?

I also use Docker.

ghn commented 3 years ago

Yes I changed token_endpoint and profile_api_url in the production.ini.

sanamart commented 3 years ago

Hi. And how did you know what values were correct? I have tried with multiple values and it is still not working for me. Should i also change something in my docker-compose.yml?