Skip to content Skip to sidebar Skip to footer

How To Handle Cors In A Service Account Call To Google Oauth?

I access a Google calendar using a service account. This means that the owner of the calendar will not be prompted for his authorization. This works fine in Python, where I make a

Solution 1:

You can't.

Client side and server side code need to interact with OAuth in different ways.

Google provide documentation explaining the client side process.

Importantly, part of it involves redirecting to Google's servers instead of accessing them with fetch or XMLHttpRequest.

Solution 2:

@Quentin's answer "You can't" is the right one for my question ("how can I force the server to send back the right header").

This is a decision at Google not to provide this header, effectively cutting off any non-interactive applications.

As a solution, I will look at

  • how to force the browser not to take into account the security mechanisms provided by CORS (there seems to be some ways through extensions or command-line arguments, I will update this answer once I find it)
  • or write an intermediate layer which will query the data for me and pass them verbatim to the application (this is equivalent, in my case, of just making the query from JS - but it adds an extra layer of code and server)

Post a Comment for "How To Handle Cors In A Service Account Call To Google Oauth?"