google / GoogleSignIn-iOS

Enables iOS and macOS apps to sign in with Google.
https://developers.google.com/identity/sign-in/ios
Apache License 2.0
472 stars 189 forks source link

Breaking issue: No visible @interface for 'OIDAuthorizationResponse' declares the selector 'tokenExchangeRequestWithAdditionalParameters:' #376

Closed RebinX1 closed 5 months ago

RebinX1 commented 5 months ago

Yesterday my Xcode app and Simulator got updated automatically to the latest version, Xcode 15.3 and IOS 17.4.

After that i tried to run one of my project and it started to fail, i thought it was xcode being xcode and it should be an issue with my project and configuration.

After many research i decided to updated all of my packages. my project include Firebase and GoogleSignIn and some other packages. starting to update one by one i was still getting the same error, then when i reached the GoogleSignIn it was still the same version 7.0.0, i decided to remove it and its implementation from my project.

then all of a sudden the error disappeared! i add it again to my project and then i got a different error inside that library!

the error was:

No visible @interface for 'OIDAuthorizationResponse' declares the selector 'tokenExchangeRequestWithAdditionalParameters:'

Screenshot 2024-03-09 at 2 15 51 AM

i dont know what to do right now, my app depend highly on google sign in and this is breaking that authentication state.

i tried to decrease firebase version and deployment version but none worked so far!

mdmathias commented 5 months ago

What version of AppAuth are you seeing pulled in? If it's 1.7.0, then you can use this method and pass nil to the additionalHeaders parameter.

https://github.com/openid/AppAuth-iOS/blob/master/Source/AppAuthCore/OIDAuthorizationResponse.h#L123

RebinX1 commented 5 months ago

the AppAuth that i see is indeed 1.7.0, as its shown in the provided image.

i just added GoogleSignIn library and that issue appears.

Screenshot 2024-03-09 at 2 40 56 AM
mdmathias commented 5 months ago

Gotcha. Please take a look at my previous comment and update your method call. This will unblock you for now while I work on a patch release to add back the method that was removed.

RebinX1 commented 5 months ago

thanks, i checked the previous comment and its code, not sure what you meant by updating my method call.

but this is the code that i use to call the googleSignIn:

`import Foundation import GoogleSignIn import GoogleSignInSwift

final class GoogleSignInHelper {

@MainActor
func signIn() async throws -> GoogleSignInResultModel{
    guard let topVC = Utilities.shared.topViewController() else { throw URLError(.cannotFindHost) }

    let gidSignInResult = try await GIDSignIn.sharedInstance.signIn(withPresenting: topVC)

    guard let idToken = gidSignInResult.user.idToken?.tokenString else { throw URLError(.badServerResponse) }

    let accessToken = gidSignInResult.user.accessToken.tokenString
    let name = gidSignInResult.user.profile?.name
    let email = gidSignInResult.user.profile?.email

    let tokens = GoogleSignInResultModel(idToken: idToken, accessToken: accessToken, name: name, email: email)

    return tokens
}

}`

and i wanted to mention that the build fails to run, i am not sure how to update the library code. further assistance is appreciated.

[

https://github.com/google/GoogleSignIn-iOS/assets/40316130/7b275980-b61c-48ef-9c5f-446b9ada07a7

](url)

mdmathias commented 5 months ago

I apologize. Yes, this problem needs to be fixed here and not with you. AppAuth 1.7.0 is breaking Google Sign-In iOS. I am working on a fix right now.

RebinX1 commented 5 months ago

okay so should i just update my packages to the latest version and it should work fine, right?

mdmathias commented 5 months ago

You will have to wait on a fix for AppAuth. I am working on it right now. Google Sign-In iOS (GSI) depends upon AppAuth, and a version of AppAuth released that broke GSI. Please stay tuned. Sorry for this disruption.

mdmathias commented 5 months ago

@RebinX1 would you mind testing again? https://github.com/openid/AppAuth-iOS/releases/tag/1.7.1 should fix the problem you were seeing.

If you're using Swift Package Manager, this patch release is live and Google Sign-In iOS should pull in AppAuth 1.7.1. If you're using CocoaPods, we are pushing the patch release as I type this...and I just got the email that it succeeded.

Please me know if this error or any other error is present. Thanks and sorry for the trouble!

yuuki00682200 commented 5 months ago

Thanks, I was having the same error, so thanks for the help! I added a new https://github.com/openid/AppAuth-iOS.git .in SwiftPackagemanager and the error was resolved😭

RebinX1 commented 5 months ago

Issue is fixed. thank you for the quick support @mdmathias.

mdmathias commented 5 months ago

Thanks for reporting and your patience!

krishnaprasadkuchur commented 5 months ago

I ran into similar build issues due to the missing method, and had to pin the version of AppAuth to 1.6.2. Thank you for the quick fix @mdmathias .

acwints commented 5 months ago

is there a fix for this? our app is still running into issues

ARC Semantic Issue (Xcode): No visible @interface for 'OIDTokenRequest' declares the selector 'initWithConfiguration:grantType:authorizationCode:redirectURL:clientID:clientSecret:scope:refreshToken:codeVerifier:additionalParameters:'

mdmathias commented 5 months ago

@acwints I believe that method was added back in https://github.com/openid/AppAuth-iOS/pull/826, which was included in the 1.7.1 patch release. Please make sure that the version you're using is 1.7.1. Please also let me know if you're seeing any other issue.