python-tailscale icon indicating copy to clipboard operation
python-tailscale copied to clipboard

Add support for OAuth clients

Open williamjacksn opened this issue 5 months ago • 11 comments

Are you interested in adding support for using OAuth clients to authenticate? Regular API keys expire after at most 90 days, but OAuth client secrets never expire. This is helpful when setting up automation scripts where you don't want to have to update the key periodically.

I think this would not be too difficult:

  • [ ] Add class variables for oauth_client_id and oauth_client_secret to the Tailscale class
  • [ ] Add method to call https://api.tailscale.com/api/v2/oauth/token and save the token as the api_key on the class
  • [ ] Change the _request() method to send the header Authorization: Bearer [...] instead of basic auth

The API documentation suggests you can use Authorization: Bearer [...] with a normal API key as well.

williamjacksn avatar Jul 02 '25 00:07 williamjacksn

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

github-actions[bot] avatar Aug 01 '25 08:08 github-actions[bot]

@frenck Any thoughts on this proposal?

williamjacksn avatar Aug 01 '25 15:08 williamjacksn

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

github-actions[bot] avatar Sep 01 '25 08:09 github-actions[bot]

I am happy to submit a pull request if it is likely to be accepted.

williamjacksn avatar Sep 01 '25 15:09 williamjacksn

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

github-actions[bot] avatar Oct 03 '25 08:10 github-actions[bot]

Activity on this issue.

williamjacksn avatar Oct 03 '25 12:10 williamjacksn

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues. Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

github-actions[bot] avatar Nov 03 '25 08:11 github-actions[bot]

@williamjacksn I tried making a PR #379 for this a while ago, but @frenck never re-reviewed after I address his first round of feedback

clayrosenthal avatar Nov 09 '25 23:11 clayrosenthal

I think this repo needs additional maintainers...

edel-macias-cubix avatar Nov 10 '25 00:11 edel-macias-cubix

Thanks for letting me know @clayrosenthal. It's too bad this repo has the nice name on PyPI:

  • https://pypi.org/project/tailscale/

And I see we have some other options:

  • https://pypi.org/project/tailscale_agent/ | https://github.com/kevinbringard/tailscale-python-client/
  • https://pypi.org/project/tailscale-fixed/ | https://github.com/lmagyar/python-tailscale

I ended up publishing my own:

  • https://pypi.org/project/tailscale-api/

williamjacksn avatar Nov 12 '25 18:11 williamjacksn

tailscale-fixed "author" here (just merged eg. together and published it in a hurry, first fix is already out...)

As I see both tailscale_agent and tailscale-api are non-async.

And tailscale_agent covers a lot of (or all?) the API functions, but I don't see structured dataclasses, and tailscale-api covers only the devices function, and the model lacks ClientConnectivity, ClientSupports, Latency.

Correct me if I'm wrong, I'm not a python guru and only run through the sources.

lmagyar avatar Nov 12 '25 21:11 lmagyar