Skip to content

Commit

Permalink
Fixed SSO login methods (#60)
Browse files Browse the repository at this point in the history
Co-authored-by: sfc-gh-mobilize-mountain-sa@snowflake.com <sfc-gh-mobilize-mountain-sa>
  • Loading branch information
sfc-gh-jbarrantes authored May 29, 2024
1 parent adcd910 commit 5015238
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion SnowflakePS/Commands/Authentication/ConnectAppCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ protected override void ProcessRecord()
// Authenticate with SSO
int localPort = GetRandomUnusedPort();

string ssoLoginLinkResult = SnowflakeDriver.GetSSOLoginLinkForAccountAndUser(appUserContext.AccountUrl, appUserContext.AccountName, appUserContext.UserName, localPort);
string ssoLoginLinkResult = SnowflakeDriver.GetSSOLoginLinkForAccountAndUser(appUserContext.AccountUrl, appUserContext.AccountName, appUserContext.UserName, localPort, appUserContext.Cookies);
if (ssoLoginLinkResult.Length == 0)
{
throw new InvalidCredentialException(String.Format("Invalid response on getting SSO for user {0}@{1}", appUserContext.UserName, appUserContext.AccountName));
Expand Down
5 changes: 3 additions & 2 deletions SnowflakePS/UtilityDrivers/SnowflakeDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public static string GetMasterTokenAndSessionTokenFromSSOToken(string accountUrl
cookies: cookies, snowflakeContext: String.Empty, referer: String.Empty, classicUIAuthToken: String.Empty);
}

public static string GetSSOLoginLinkForAccountAndUser(string accountUrl, string accountName, string userName, int returnRedirectPortNumber)
public static string GetSSOLoginLinkForAccountAndUser(string accountUrl, string accountName, string userName, int returnRedirectPortNumber, CookieContainer cookies)
{
string requestJSONTemplate =
@"{{
Expand All @@ -248,7 +248,8 @@ public static string GetSSOLoginLinkForAccountAndUser(string accountUrl, string
"session/authenticator-request",
"application/json",
requestBody,
"application/json", null);
"application/json",
cookies: cookies);
}

#endregion
Expand Down

0 comments on commit 5015238

Please sign in to comment.