Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for bearer authentication #119

Open
tobixen opened this issue Dec 25, 2020 · 9 comments
Open

Support for bearer authentication #119

tobixen opened this issue Dec 25, 2020 · 9 comments

Comments

@tobixen
Copy link
Member

tobixen commented Dec 25, 2020

Depended on by tobixen/calendar-cli#81

@azmeuk
Copy link
Contributor

azmeuk commented Jun 29, 2022

I confirm that Bearer authentication is not supported yet, and that it would be a nice thing to have.

I let this traceback here so people can google it.

  File "/usr/lib/python3.10/site-packages/caldav/davclient.py", line 362, in principal
    self._principal = Principal(client=self, *largs, **kwargs)
  File "/usr/lib/python3.10/site-packages/caldav/objects.py", line 404, in __init__
    cup = self.get_property(dav.CurrentUserPrincipal())
  File "/usr/lib/python3.10/site-packages/caldav/objects.py", line 175, in get_property
    foo = self.get_properties([prop], **passthrough)
  File "/usr/lib/python3.10/site-packages/caldav/objects.py", line 198, in get_properties
    response = self._query_properties(props, depth)
  File "/usr/lib/python3.10/site-packages/caldav/objects.py", line 142, in _query_properties
    return self._query(root, depth)
  File "/usr/lib/python3.10/site-packages/caldav/objects.py", line 160, in _query
    ret = getattr(self.client, query_method)(
  File "/usr/lib/python3.10/site-packages/caldav/davclient.py", line 410, in propfind
    return self.request(url or self.url, "PROPFIND", props,
  File "/usr/lib/python3.10/site-packages/caldav/davclient.py", line 557, in request
    raise NotImplementedError("Auth method %s not supported yet" % auth_type)
NotImplementedError: Auth method bearer not supported yet

@tobixen tobixen changed the title OAuth 2.0 support needed for Google calendar Support for bearer authentication Jun 29, 2022
@azmeuk
Copy link
Contributor

azmeuk commented Jun 29, 2022

I suppose implementing would result in:

  • storing a token parameter in DAVClient (alongside with username and password). I think this can be expected that users retrieve the token by their own, and that it is not in the scope of python-caldav
  • check wether the server supports the bearer authentication method
  • if so, and a token has been provided to the library, add a Authorization header which value is Bearer <TOKEN> where <TOKEN> is the token content.

@tobixen
Copy link
Member Author

tobixen commented Jun 29, 2022

Yes - it shouldn't be too difficult, if only having a server to test with. Well, there is always the Google servers :-)

@tobixen
Copy link
Member Author

tobixen commented Oct 23, 2022

This won't go into v0.10 I'm afraid.

@azmeuk
Copy link
Contributor

azmeuk commented Jan 16, 2023

This is fixed by #260

@devmount
Copy link

Is connecting to a Google CalDAV calendar with OAuth2 already possible? If yes, is there documentation / an example of how to do so? I would like to use this lib for Google calendars as well. Thanks for the great work so far 🙏🏻

@tobixen
Copy link
Member Author

tobixen commented Apr 11, 2023

In theory it should be possible, but there exists no documentation or examples on how to connect to Google (and I don't have time looking into it this week nor next, probably not even this month nor next), and pull request #260 also seem to lack documentation and test code.

https://developers.google.com/calendar/caldav/v2/guide seems to be a relevant resource if you want to give it a go.

@devmount
Copy link

I see, thank you for the quick reply anyway! I see if I can get it to work or if I need to use another lib for Google (which I would like to avoid).

@tobixen
Copy link
Member Author

tobixen commented Apr 18, 2024

I just had a quick look into the documentation - we're still lacking documentation on how to connect to Google. Did anyone successfully connect to their Google calendar?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants