@@ -14,8 +14,7 @@ use crate::connection::{Connection, QueryType};
14
14
use crate :: requests:: { CertLoginRequest , CertRequestData } ;
15
15
use crate :: requests:: {
16
16
ClientEnvironment , LoginRequest , LoginRequestCommon , OAuthLoginRequest , OAuthRequestData ,
17
- PasswordLoginRequest , PasswordRequestData , RenewSessionRequest , SPCSOAuthLoginRequest ,
18
- SPCSOAuthRequestData , SessionParameters ,
17
+ PasswordLoginRequest , PasswordRequestData , RenewSessionRequest , SessionParameters ,
19
18
} ;
20
19
use crate :: responses:: AuthResponse ;
21
20
@@ -457,8 +456,15 @@ impl Session {
457
456
}
458
457
459
458
async fn spcs_create ( & self ) -> Result < AuthTokens , AuthError > {
459
+ // We should wait until we are ready to send the request
460
+ // before we read the token, as it expires after 10 minutes
460
461
let token = fs:: read_to_string ( "/snowflake/session/token" )
461
462
. map_err ( |_| AuthError :: MissingSPCSOAuthToken ) ?;
463
+
464
+ // fixme: I am not sure if waiting until now to read all of these
465
+ // is necessary or not, but I figured I would allow the user
466
+ // to override these on instantiation and only replace the
467
+ // user provided ones with the env provides ones if necessary
462
468
let warehouse = self
463
469
. warehouse
464
470
. clone ( )
@@ -470,8 +476,8 @@ impl Session {
470
476
let schema = self . warehouse . clone ( ) . or ( env:: var ( "SNOWFLAKE_SCHEMA" ) . ok ( ) ) ;
471
477
let role = self . warehouse . clone ( ) . or ( env:: var ( "SNOWFLAKE_ROLE" ) . ok ( ) ) ;
472
478
473
- let body = SPCSOAuthLoginRequest {
474
- data : SPCSOAuthRequestData {
479
+ let body = OAuthLoginRequest {
480
+ data : OAuthRequestData {
475
481
login_request_common : self . login_request_common ( ) ,
476
482
token,
477
483
authenticator : "OAUTH" . to_string ( ) ,
0 commit comments