Invalid tenant ID provided while calling Graph API Endpoints

joaoaddyai 0 Reputation points
2024-07-25T16:17:03.4433333+00:00

Hello

I've been testing this endpoints locally, and everything works fine on localhost.

I deployed my backend and when I try to call the endpoint I now get this error.

Invalid tenant ID provided. You can locate your tenant ID by following the instructions here: https://learn.microsoft.com/partner-center/find-ids-and-domain-names

What do I need to do different?

I get the user access token with Auth JS on the frontend.

        url = "https://graph.microsoft.com/v1.0/me/mailFolders"
        headers = {
            "Authorization": f"Bearer {g.access_token}",
        }

        response = requests.get(url, headers=headers)
        if response.status_code != 200:
            return {
                "success": False,
                "error": f"Error getting labels: {response.content}"
            }, 400
        

        transformed_data = [transform_labels(folder) for folder in response.json()['value']]

        return transformed_data

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,436 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
20,618 questions
0 comments No comments
{count} votes