Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SNOW-1332126: Remove "!" From Okta Authentication validateURLs Function in lib/authentication/auth_okta.js line 174 #826

Closed
joshcazalas opened this issue Apr 16, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@joshcazalas
Copy link

The function, validateURLs, in lib/authentication/auth_okta.js has an "!" on line 174 that needs to be removed. Currently, the function is throwing an error when the auth url and sso url match, when it should only be throwing the error when those two values do NOT match. Removing the "!" would fix this validation.

Please answer these questions before submitting your issue.
In order to accurately debug the issue this information is required. Thanks!

  1. What version of NodeJS driver are you using?
    v20.12.2

  2. What operating system and processor architecture are you using?
    Ubuntu 22.04

  3. What version of NodeJS are you using?
    (node --version and npm --version)
    v20.12.2

  4. What are the component versions in the environment (npm list)?
    [email protected]

5.Server version:* E.g. 1.90.1
You may get the server version by running a query:

SELECT CURRENT_VERSION();

8.14.2

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.

Attempted to connect to Snowflake using Okta Authentication

const snowflake = Snowflake.createConnection({
   account: `${process.env.snowflakeAccount}.${process.env.snowflakeRegion}`,
   authenticator: "https://org-name.okta.com",
   username: process.env.snowflakeUsername,
   password: process.env.snowflakePassword,
   role: process.env.snowflakeRole,
   warehouse = process.env.snowflakeWarehouse
});
await snowflake.connectAsync(function (err) {
   if (err) {
      console.error("Unable to connect: " + err.message);
   }
   else {
      console.log("Successfully connected as id: " + snowflake.getId());
});
  1. What did you expect to see?

    What should have happened and what happened instead?

What should have happened: Successfully connected as id: <connection_id>

What happened instead: Unable to connect: The prefix of the SSO/token URL and the specified authenticator do not match.

If the "!" is removed from the validateURLs function, the library behaves as expected and Okta authentication is successful.

  1. Can you set logging to DEBUG and collect the logs?

    https://community.snowflake.com/s/article/How-to-generate-log-file-on-Snowflake-connectors

e.g
Add this to get standard output.

var snowflake = require('snowflake-sdk');
snowflake.configure(
{
  logLevel: 'trace'
});

The auth url being passed in the code block above is: https://org-name.okta.com
The sso url that is returned when attempting login with the code block above is: https://org-name.okta.com/...
The hosts and protocols match in both urls, but the validateURLs function is incorrectly returning a mismatch due to the "!" on line 174, resulting in this error message: Unable to connect: The prefix of the SSO/token URL and the specified authenticator do not match.

When the "!" is removed from line 174 in the validateURLs function, the following success message is printed: Successfully connected as id: <connection_id>

  1. What is your Snowflake account identifier, if any? (Optional)
@joshcazalas joshcazalas added the bug Something isn't working label Apr 16, 2024
@github-actions github-actions bot changed the title Remove "!" From Okta Authentication validateURLs Function in lib/authentication/auth_okta.js line 174 SNOW-1332126: Remove "!" From Okta Authentication validateURLs Function in lib/authentication/auth_okta.js line 174 Apr 16, 2024
@joshcazalas
Copy link
Author

After submitting this issue I realized that I was two versions back and the most recent release has a fix for this issue, so I'll close this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant