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

Invalid `GIDConfiguration` object reports unsupported URL error, rather than something more descriptive

Open peterkos opened this issue 4 years ago • 1 comments

Background

I'm loading the clientID key from an .xcconfig file into an AuthManager, which is responsible for creating the GIDConfiguration object.

// AuthManager.swift
var config = GIDConfiguration(clientID: "asdf")

init() {
    // Fetches the API token from an .xcconfig thru the Info.plist
    if let clientID = Bundle.main.object(forInfoDictionaryKey: "GID_CLIENT_ID") as? String {
        config = GIDConfiguration(clientID: clientID)
    }
}

However, if no code is provided, I receive a runtime crash with the following error:

Your app is missing support for the following URL schemes: asdf'
terminating with uncaught exception of type NSException

Suggestion

I'd hope that for new users this would have a more detailed explanation, such as "Invalid GIDconfiguration object; key was invalid". "Missing URL scheme support' to me would imply an issue with the AppDelegate rather than a config object.

I recognize this is totally minor (especially given a lot of other API design issues I've experienced in v6 with SwiftUI) but I figured I might as well report it :)

peterkos avatar Aug 16 '21 01:08 peterkos

The error you mention is an exception from GIDSignIn and should only be triggered if the app has not declared support for the appropriate custom URL scheme given the configured client ID.

Are you setting the custom URL scheme to match the client ID specified in your GIDConfiguration object?

I agree that the error message could be clearer.

petea avatar Aug 16 '21 22:08 petea