GoogleSignIn-iOS icon indicating copy to clipboard operation
GoogleSignIn-iOS copied to clipboard

Login request crash

Open zhengyipei opened this issue 10 months ago • 2 comments

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

zhengyipei avatar Feb 25 '25 03:02 zhengyipei

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?

brnnmrls avatar Mar 04 '25 00:03 brnnmrls

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; }

aforkalyuk avatar Mar 06 '25 09:03 aforkalyuk

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.

onewOne avatar Jul 10 '25 02:07 onewOne

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.

Aloisius avatar Oct 20 '25 22:10 Aloisius