@@ -54,7 +54,7 @@ def __init__(self):
54
54
home_account_id or "" ,
55
55
environment or "" ,
56
56
self .CredentialType .ACCESS_TOKEN ,
57
- client_id ,
57
+ client_id or "" ,
58
58
realm or "" ,
59
59
target or "" ,
60
60
]).lower (),
@@ -128,8 +128,11 @@ def add(self, event, now=None):
128
128
with self ._lock :
129
129
130
130
if access_token :
131
- now = time .time () if now is None else now
132
- expires_in = response .get ("expires_in" , 3599 )
131
+ now = int (time .time () if now is None else now )
132
+ expires_in = int ( # AADv1-like endpoint returns a string
133
+ response .get ("expires_in" , 3599 ))
134
+ ext_expires_in = int ( # AADv1-like endpoint returns a string
135
+ response .get ("ext_expires_in" , expires_in ))
133
136
at = {
134
137
"credential_type" : self .CredentialType .ACCESS_TOKEN ,
135
138
"secret" : access_token ,
@@ -138,10 +141,9 @@ def add(self, event, now=None):
138
141
"client_id" : event .get ("client_id" ),
139
142
"target" : target ,
140
143
"realm" : realm ,
141
- "cached_at" : str (int (now )), # Schema defines it as a string
142
- "expires_on" : str (int (now + expires_in )), # Same here
143
- "extended_expires_on" : str (int ( # Same here
144
- now + response .get ("ext_expires_in" , expires_in ))),
144
+ "cached_at" : str (now ), # Schema defines it as a string
145
+ "expires_on" : str (now + expires_in ), # Same here
146
+ "extended_expires_on" : str (now + ext_expires_in ) # Same here
145
147
}
146
148
self .modify (self .CredentialType .ACCESS_TOKEN , at , at )
147
149
0 commit comments