error "Error content type text/html does not have a factory registered to be parsed" when using golang sdk for a request to the api

Teci Times 55 Reputation points
2023-06-28T12:28:14.22+00:00

Goal: Requesting the calendars of a user

Via the azure students programm I created an App in the Microsoft Azure Directory with the purpose of using the calendar api to request data from users. I want this to happen in the background with no futher manual authentication so i chose the ClientSecretCredential-workflow and configured the secret and everything.

my permissions:

grafik

I used the example code for the app authentication with go and I can succesfully request a list of Users for my application. But when i use the id of the user (I got the id from the request) and try to access the calendar, events or anything else of the User i get an error message.

my code:

    result, err := g.appClient.Users().ByUserId("user-idf").Calendars().Get(context.Background(), nil)

	if err != nil {
		fmt.Println("Got Error:", err.Error())
	}

	fmt.Println(result)

my error

content type text/html does not have a factory registered to be parsed

The exact same request with the same user id works via "Me" and a logged in user with a different authentication flow and via the graph explorere. But i need it to work without an authenticated user in the background

Microsoft Security Microsoft Graph
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Chetan Nakum 0 Reputation points
    2024-02-21T08:59:30.6233333+00:00

    I also do have the same error in PHP programming.. Can anyone here to sort it out ?


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.