File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -187,15 +187,19 @@ 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
- auto json_expires_in_val = token_json.at (oauth2_strings::expires_in);
190
+ const auto & json_expires_in_val = token_json.at (oauth2_strings::expires_in);
191
191
192
192
if (json_expires_in_val.is_number ())
193
193
result.set_expires_in (json_expires_in_val.as_number ().to_int64 ());
194
194
else
195
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 ()));
196
+ // Handle the case of a number as a JSON "string".
197
+ // Using streams because std::stoll isn't avaliable on Android.
198
+ int64_t expires;
199
+ utility::istringstream_t iss (json_expires_in_val.as_string ());
200
+ iss.exceptions (std::ios::badbit | std::ios::failbit);
201
+ iss >> expires;
202
+ result.set_expires_in (expires);
199
203
}
200
204
}
201
205
else
You can’t perform that action at this time.
0 commit comments