Google Sign In isOfflineEnabled in Standalone App

The documentation on this option is sparse. For some reason it’s only available on Android. Also, if you check the source code, it only gets used if the build is NOT standalone and the webClientId is null. So, under what circumstances does this actually get set? Only in non-standalone Android expo apps? I’m hoping to get a refresh token for use by our web server. Any clarification would be greatly appreciated!

Hey @thenumber_tech!

I might be missing something here, but what makes you say that it only gets set if the webClientId is null?

Hey @charliecruzan, it’s not documented anywhere which was why I confused at first. After digging into the code I found this in google/signin/Serialization.java

if (webClientId == null && appOwnership.equals("standalone")) {
    int clientIdIdentifier =
            context
                    .getResources()
                    .getIdentifier(
                            "default_web_client_id", "string", context.getPackageName());
    if (clientIdIdentifier != 0) {
        optionsBuilder.requestIdToken(context.getString(clientIdIdentifier));
    }
    if (isOfflineEnabled) {
        optionsBuilder.requestServerAuthCode(webClientId, isPromptEnabled);
    }
} else if (!isNullOrEmpty(webClientId)) {
    optionsBuilder.requestIdToken(webClientId);
}

I was incorrect in my original post, it’s ONLY available (correctly) for Standalone builds, but only if the webClientId is null. Not sure why because it requires the webClientId for requesting the serverAuthCode. No matter what I set webClientId as, I always get an idToken back and a null accessToken.

As I mentioned none of this is documented. It only mentions that this option is only available on Android but doesn’t explain why.

Thanks for getting back!

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.