infiniflow/ragflow · error · PermissionError

Google Drive OAuth credentials are incomplete. Please finish

Error message

Google Drive OAuth credentials are incomplete. Please finish the OAuth flow to generate access tokens.

What it means

Error "Google Drive OAuth credentials are incomplete. Please finish the OAuth flow to generate access tokens." thrown in infiniflow/ragflow.

Source

Thrown at common/data_source/google_util/auth.py:70

    oauth_creds = None
    service_creds = None
    new_creds_dict = None
    if DB_CREDENTIALS_DICT_TOKEN_KEY in credentials:
        # OAUTH
        authentication_method: str = credentials.get(
            DB_CREDENTIALS_AUTHENTICATION_METHOD,
            GoogleOAuthAuthenticationMethod.UPLOADED,
        )

        credentials_dict_str = credentials[DB_CREDENTIALS_DICT_TOKEN_KEY]
        credentials_dict = json.loads(credentials_dict_str)

        regenerated_from_client_secret = False
        if "client_id" not in credentials_dict or "client_secret" not in credentials_dict or "refresh_token" not in credentials_dict:
            try:
                credentials_dict = ensure_oauth_token_dict(credentials_dict, source)
            except Exception as exc:
                raise PermissionError("Google Drive OAuth credentials are incomplete. Please finish the OAuth flow to generate access tokens.") from exc
            credentials_dict_str = json.dumps(credentials_dict)
            regenerated_from_client_secret = True

        # only send what get_google_oauth_creds needs
        authorized_user_info = {}

        # oauth_interactive is sanitized and needs credentials from the environment
        if authentication_method == GoogleOAuthAuthenticationMethod.OAUTH_INTERACTIVE:
            authorized_user_info["client_id"] = OAUTH_GOOGLE_DRIVE_CLIENT_ID
            authorized_user_info["client_secret"] = OAUTH_GOOGLE_DRIVE_CLIENT_SECRET
        else:
            authorized_user_info["client_id"] = credentials_dict["client_id"]
            authorized_user_info["client_secret"] = credentials_dict["client_secret"]

        authorized_user_info["refresh_token"] = credentials_dict["refresh_token"]

        authorized_user_info["token"] = credentials_dict["token"]
        authorized_user_info["expiry"] = credentials_dict["expiry"]

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Complete the OAuth consent flow so access and refresh tokens are stored.

Example fix

# open the OAuth URL, consent, and let the callback store tokens

When it happens

Trigger: Thrown at common/data_source/google_util/auth.py:70 when the library encounters an invalid state.

Common situations: Only the OAuth client config is present but no user tokens; finishing the OAuth flow prevents this error.


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/63d14a4342bbf465. Report an issue: GitHub.