Login request crash
Describe the bug
- (nullable NSDictionary<NSString *,NSString *> *) additionalTokenRefreshParametersForAuthSession:(GTMAuthSession *)authSession { return [GIDEMMSupport updatedEMMParametersWithParameters: authSession.authState.lastTokenResponse.additionalParameters]; }
[GIDEMMSupport updatedEMMParametersWithParameters: authSession.authState.lastTokenResponse.additionalParameters] , There are cases where the value returned by this method does not meet the required type
Hi! Looking for more context. Would you happen to know what the type(s) of the value you're getting is? Do you have any guesses on what cases specifically may return a different type?
private func authorizeRequest(withArguments args: AuthorizationArguments) {
serialAuthArgsQueue.sync {
authorizationArgs.append(args)
}
let additionalRefreshParameters = delegate?.additionalTokenRefreshParameters?(
forAuthSession: self
)
@objc optional func additionalTokenRefreshParameters(
forAuthSession authSession: AuthSession
) -> [String: String]?
additionalTokenRefreshParameters must return [String: String]?, but in
[GIDEMMSupport updatedEMMParametersWithParameters: authSession.authState.lastTokenResponse.additionalParameters]
authSession.authState.lastTokenResponse.additionalParameters =
{ "refresh_token_expires_in" = 604799; }
Unreviewed apps with scope for login will have this issue.
App review doesn't crash.
My guess is that the scope authorization for unaudited apps has an expiration time, but this time is not officially handled as a string type.
The fix #559 by @brnnmrls will still crash if emmSupport is disabled, because the dictionary passed in that is returned in if emmSupport is null can have the "refresh_token_expires_in" = long_value in it:
+ (NSDictionary<NSString *,NSString *> *)parametersWithParameters:(NSDictionary *)parameters
emmSupport:(nullable NSString *)emmSupport
isPasscodeInfoRequired:(BOOL)isPasscodeInfoRequired {
if (!emmSupport) {
return parameters;
}
...
Changing this to return [GIDEMMSupport dictionaryWithStringValuesFromDictionary:parameters] instead fixes it.