question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cognito OAuth authentication always redirect to localhost:8000....

See original GitHub issue

Hello there,

I have deployed Scoold in a Kubernetes cluster with the Chart Helm reference of this project. I am now trying to configure the OAuth authentication with Cognito! I have been able to configure about 90% of the authentication flow through Paraio backend. I’ve been stuck for 2 days now on the same problem that when the user is correctly authenticated through Paraio backend, it sends a response at:

https://{my_scoold_domain}/signin/success?jwt=id

After, getting this reponse, I am instanly redirect to

localhost:8000

which is Scoold local address running in pod. The element that allows me to affirm that there is a redirection error at the end of the flow is that when I manually go back to my scoold home page (https://{my_scoold_domain}), I can see that I am logged in and the session cookie have been correctly set. So If I was able to force a redirection to my scoold home page, the authentication flow would be 100% implemented with Cognito.

Here is my application.conf that I’m passing trough the Chart Helm:

applicationConf: |
  para.env = production
  para.endpoint = "https://paraio.com"
  para.app_name = "{app_name}"
  para.access_key = "{access_key }"
  para.secret_key = "{secret_key }"
  para.password_auth_enabled = false
  para.security.signin_success = "https://{my_scoold_domain}/signin/success?jwt=id" #currently not working on my chart deployment (need manual config in paraio console)
  para.security.signin_failure = "https://{my_scoold_domain}/signin/success?jwt=id" #currently not working on my chart deployment (need manual config in paraio console)
  para.oa2_app_id = "{oa2_app_id }"
  para.oa2_secret = "{oa2_secret }"
  para.security.oauth.authz_url = "https://{cognito_domain}.auth.ca-central-1.amazoncognito.com/login"
  para.security.oauth.token_url = "https://{cognito_domain}.auth.ca-central-1.amazoncognito.com/oauth2/token"
  para.security.oauth.profile_url = "https://{cognito_domain}.auth.ca-central-1.amazoncognito.com/oauth2/userInfo"
  para.security.oauth.provider = "Continue with Cognito"

I have checked all OAuth issues that might have been helpful, but none has any concrete solution to this problem 😞 . So a small summary of the problem and how I’ve got it:

  1. Click on the Cognito authentication button
  2. Been redirect to:
https://{cognito_domain}.auth.ca-central-1.amazoncognito.com/login?response_type=code&client_id={client_id}&scope=&state={para_access_key}&redirect_uri=https://paraio.com/oauth2_auth
  1. Authenticating with the right identity provider
  2. Identity provider return the user information
  3. Redirection call to Paraio backend for getting jwt token
https://paraio.com/oauth2_auth?code={user_id_code}&state={para_access_key}
  1. Redirection call to my scoold app with jwt token:
https://{my_scoold_domain}/signin/success?jwt={jwt_valid_token}
  1. The moment when the http call at step 6 is completed, we get another redirection to localhost:8000 and the web page is not found…

Thank you for your time

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
albogdanocommented, Apr 6, 2022

Also worth noting is that since Scoold 1.49.0 all para.* configuration properties in Scoold have been deprecated. Please change the prefix of all properties from para. to scoold. if you are running Scoold v1.49+. This is to prevent confusion in people configuring both Para and Scoold at the same time.

1reaction
albogdanocommented, Apr 6, 2022

Hi there! Hopefully this is easy to fix - just add para.host_url = "https://{my_scoold_domain}" and remove these two lines:

para.security.signin_success = "https://{my_scoold_domain}/signin/success?jwt=id" #currently not working on my chart deployment (need manual config in paraio console)
para.security.signin_failure = "https://{my_scoold_domain}/signin/success?jwt=id" #currently not working on my chart deployment (need manual config in paraio console)

Restart the pod and you should be done.

Read more comments on GitHub >

github_iconTop Results From Across the Web

405 method not allowed error in AWS Cognito oauth2/token ...
I was writing code in c# for token with authorization_code grant type and all calls were failing with 405 Method Not Allowed status....
Read more >
Authorize endpoint - Amazon Cognito - AWS Documentation
The /oauth2/authorize endpoint is a redirection endpoint that supports two redirect destinations. If you include an identity_provider or idp_identifier ...
Read more >
Amazon Cognito and Latest OAuth/OIDC Specifications
In this tutorial, the authorization endpoint is http://localhost:8000/api/authorization hosted on django-oauth-server. Replace CLIENT_ID and REDIRECT_URI in the ...
Read more >
Cognito redirecting to localhost on production amplify #2771
I'm using the next 11. And actual version of "next-auth": "^3.29.0". On login the next redirects to localhost:3000/api/auth/signin/cognito ...
Read more >
Bootstrapping Django App with Cognito: Personal Experience
https://any-fancy-name-you-like.auth.eu-central-1.amazoncognito.com. In “App client settings” you need to enable any of “OAuth Flows” (let's ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found