File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,16 @@ oauth2_token oauth2_config::_parse_token_from_json(const json::value& token_json
187
187
188
188
if (token_json.has_field (oauth2_strings::expires_in))
189
189
{
190
- result.set_expires_in (token_json.at (oauth2_strings::expires_in).as_number ().to_int64 ());
190
+ auto json_expires_in_val = token_json.at (oauth2_strings::expires_in);
191
+
192
+ if (json_expires_in_val.is_number ())
193
+ result.set_expires_in (json_expires_in_val.as_number ().to_int64 ());
194
+ else
195
+ {
196
+ // handle the case of a number as a JSON "string".
197
+ // std::stoll() will throw an exception if no conversion is possible.
198
+ result.set_expires_in (std::stoll (json_expires_in_val.as_string ()));
199
+ }
191
200
}
192
201
else
193
202
{
You can’t perform that action at this time.
0 commit comments