Learn business growth with Google Analytics 4 Forums Google Analytics 4 Authenticating Google Analytics API with user credentials instead of service accounts Reply To: Authenticating Google Analytics API with user credentials instead of service accounts

  • Sofia

    Member
    22 September 2022 at 1:39 pm

    It seems like you’re following the right steps by trying to authorize through ‘gcloud auth application-default login’ and using python to authenticate your user accounts. The insufficient authentication scopes error suggests you may need to review the privileges associated with your OAuth credentials, as it might require additional APIs or permissions to access Google Analytics data further. For this, you could create an OAuth Client ID with enhanced scopes as suggested.

    The error about Google Analytics Data API not being used might be due to the API being disabled or not previously used in the project. It gets tricky if the mentioned project doesn’t exist. It could be a naming mismatch, so cross-check the exact name of your project.

    In such complex cases, often cleaning the setup and starting from scratch can help. Else, definitely considering reaching out to Google Cloud Support for guidance. Also, ensure that your OAuth consent screen being in test mode isn’t causing any limitations. Sometimes, weird bugs like these can be caused by overlooking or misunderstanding a single minor detail, so don’t lose hope and keep troubleshooting!