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 Auth Token? #90

Closed
Tracked by #150 ...
Pro opened this issue May 26, 2021 · 10 comments · Fixed by #214
Closed
Tracked by #150 ...

Support for Auth Token? #90

Pro opened this issue May 26, 2021 · 10 comments · Fixed by #214

Comments

@Pro
Copy link

Pro commented May 26, 2021

In Influx 2.0 the authentication is done via tokens.

https://docs.influxdata.com/influxdb/v2.0/write-data/developer-tools/api/#example-api-write-request

Is this somehow already supported in influxdb-cxx?

@offa
Copy link
Owner

offa commented May 26, 2021

Unfortunately no, only basic auth at the moment. v2.0 isn't supported yet, but It's planed for the future.

@offa offa added the feature label May 26, 2021
@offa offa mentioned this issue Aug 4, 2021
6 tasks
@alex-saoulis
Copy link

alex-saoulis commented May 6, 2022

Do you have any solid plans for influxdb-2.x authentication yet? I have added http support for auth tokens in my fork of this repo. It is largely untested but it works for my use-case (simple read operation). The API functionality I've added is to include the token in the input url as follows, which I'm sure can be improved:
[protocol]://[username:password@]host:port[?db=database] --[auth_token]

@offa
Copy link
Owner

offa commented May 6, 2022

Not yet, sorry.

If you have an implementation already, it feel free to contribute! 😃 Let me know if you need some help.

A more common format would be [protocol]://[auth_token@]host…] I guess. So it becomes user:pw@ for basic credentials, but token@ for tokens.

@alex-saoulis
Copy link

I will have a look at implementing this and contributing when I get the time. My only worry with [protocol]://[auth_token@]host…] was I don't know whether ':' is an allowed character in the auth_token, because if it is that would break the url parser. Do you have any idea if it is? 😃 I assume it's unlikely for exactly this issue it would cause.

@offa
Copy link
Owner

offa commented May 12, 2022

I wouldn't expect : in tokens, I can't remember to see one at any type of service.

@offa offa added this to the v0.8.0 milestone Feb 11, 2023
@SimonEverts
Copy link

@offa maybe this will be helpfull too:
https://github.com/SimonEverts/influxdb-cxx/tree/feature/90-support-api-token

@offa
Copy link
Owner

offa commented Mar 17, 2023

Yes, it might be worth to add an additional API that enables programmatic setting of connection infos. Using an URL string becomes limiting at some point.

While I'm not sure how to design the factory API yet (given, there are some different types transport), are you interested to submit the changes to Transport and HTTP (+ tests) as a PR already?

@kasparthommen
Copy link

Hi all, any news on this? What about merging the proposed changes?

@offa
Copy link
Owner

offa commented Oct 20, 2023

I'm going to implement basic url string based token support (as credentials are now). The linked changes aren't compatible anymore, the http backend has been replaced in the recent releases.

offa added a commit that referenced this issue Oct 20, 2023
@offa offa linked a pull request Oct 20, 2023 that will close this issue
@offa
Copy link
Owner

offa commented Oct 20, 2023

PR is open (#214).

I had no opportunity to test it on a real database yet, if someone could give it a try.

@offa offa closed this as completed in #214 Oct 24, 2023
@offa offa added the backport label Oct 31, 2023
@offa offa mentioned this issue Oct 31, 2023
6 tasks
offa added a commit that referenced this issue Oct 31, 2023
@offa offa removed the backport label Nov 3, 2023
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.

5 participants