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.

IdP url opened twice

See original GitHub issue

Driver version

2.0.882

Redshift version

Not a Redshift problem

Client Operating System

MacOS Big Sur

Python version

3.7.7

Table schema

Not a Redshift problem

Problem description

Connecting to a Redshift cluster with credentials being provided by IdP (Okta in this case) results in Okta login_url page being opened twice if I have already signed in previously. To make it a bit more confusing, when redirected back to http://localhost:7890/redshift/ the page shows “This site can’t be reached”. Connection is established after that with no issues and I can execute the query.

I’ve also setup a connection in DBeaver using the same IdP and the same login_url. In this case the login_url page is opened only once and a proper message saying Thank you for using Amazon Redshift! You can now close this window. is shown.

  1. Expected behaviour: IdP login_url is opened once. After successful login and redirect to http://localhost:7890/redshift/, the page shows the same Thank you for using Amazon Redshift! You can now close this window.

  2. Actual behaviour: IdP login_url is opened twice. When redirected to http://localhost:7890/redshift/ it shows “This site can’t be reached”

  3. Error message/stack trace: No errors other than “This site can’t be reached” in the browser

  4. Any other details that can be helpful: abc

Python Driver trace logs

None

Reproduction code

import redshift_connector


conn = redshift_connector.connect(
    iam=True,
    ssl=True,
    host="REDSHIFT_ENDPOINT",
    port=5439,
    database="DB_NAME",
    db_user="IDP_USERNAME",
    region="AWS_REGION",
    cluster_identifier="CLUSTER_NAME",
    login_url="IDP_LOGIN_URL",
    credentials_provider="BrowserSamlCredentialsProvider",
    user="",
    password=""
)

cursor: redshift_connector.Cursor = conn.cursor()
cursor.execute("select current_user")

result = cursor.fetchone()
print(result)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
Brooke-whitecommented, Jul 9, 2021

Hi @ivica-k ,

Thank you for taking the time to dive into this issue. I am happy we have been able to determine a root cause for this issue…this also explains why I was unable to reproduce as my timezone is PST 😃

The team would be happy to have your contribution for this issue – the edit you provided looks good!

Back to the “Connection Refused” screen in the browser following authentication, the team has merged a fix for this and it will be included in our next release, which is scheduled for July 19.

0reactions
Brooke-whitecommented, Jul 14, 2021

Hey @ivica-k ,

Every CredentialsHolder object has an expiration. You can think of the CredentialsHolder class as wrapper around the temporary credentials retrieved when using IAM authentication.

What should happen with self.expiration in this case? Should it be changed based on the local timezone? Or should I maybe add self.expiration_local and change self.expiration to self.expiration_utc ?

Let’s chat more in the PR, but I think we can keep expiration as is and do a conversion to the local timezone within is_expired(). We should probably add a logging.debug statement within this method which outputs the original UTC datetime and the localized one. This could be helpful to future debugging surrounding this area of the code base 😃

Thanks again for diving into this issue, the team really appreciates your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I have two separate SAML applications login to an ...
Is it possible to log the user into my IdP (or Auth0/OneLogin) automatically on that second app without having to click the login...
Read more >
Saml2 Logout request sent to IdP twice resulting in error. #1117
A single SLO request is sent to the IdP. What happens instead. Two SLO requests are sent to the IdP, the first of...
Read more >
Query string is being double URL encoded during redirection ...
This can lead to double URL encoded or even multiple URL encoded query strings, that can break things like SAML requests (which are...
Read more >
NetScaler as a SAML IdP | Issues when user tries to re-login ...
Hello,We have configured NetScaler as IdP for a Service Provider's portal using SAML, everything works fine until user logs out and tries to ......
Read more >
Nov 30, 2022 - •Knowledge Article - Okta Support
Overview. For each user sign-in using the Okta custom sign-in widget, the /.well-known/webfinger endpoint is being called twice against the rate limit.
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