databricks / databricks-sdk-py

Databricks SDK for Python (Beta)
https://databricks-sdk-py.readthedocs.io/
Apache License 2.0
352 stars 117 forks source link

OAuth Cross-origin error #68

Closed andrefurlan-db closed 1 year ago

andrefurlan-db commented 1 year ago

Getting Cross-origin token redemption is permitted only for the 'Single-Page Application' client-type. Request origin: 'http://localhost:8020/'. when using OAuth client with Azure.

It works if I remove the code for both u2m and m2m:

        if 'microsoft' in self._client.token_url:
            # Tokens issued for the 'Single-Page Application' client-type may
            # only be redeemed via cross-origin requests
            headers = {'Origin': self._client.redirect_url}
nfx commented 1 year ago

@andrefurlan-db but only SPA supports the PKCE auth... is dropping the PKCE verification something you want?

andrefurlan-db commented 1 year ago

No, but: Right now Azure does not work because of this error. Removing that code I pasted fixes the issue

nfx commented 1 year ago

@andrefurlan-db what your OAuth app configuration? should be something like this:

image
andrefurlan-db commented 1 year ago

No. Our partner documentation states app to be: "Public client/Native", not Single-page.

nfx commented 1 year ago

@andrefurlan-db in the requirements document you've provided, you emphasised about PKCE everywhere ;)

andrefurlan-db commented 1 year ago

Yes, like I mentioned, removing the Origin header fixes the issue and it works with PKCE. I don't understand what is this about? It is just wrong to add that header.

nfx commented 1 year ago

I'll cut a release on Friday (CET) with the fix for this

andrefurlan-db commented 1 year ago

Thanks!