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

Create session with existing token #36

Open
sigmonsays opened this issue Jun 29, 2020 · 1 comment
Open

Create session with existing token #36

sigmonsays opened this issue Jun 29, 2020 · 1 comment

Comments

@sigmonsays
Copy link

sigmonsays commented Jun 29, 2020

If I have an existing token, there seems to be no way to create a session with a token and a *http.Client

If I construct a *Session manually i can specify a token, however client is not exported I can't specify a token and set a custom http client. By exporting client we achieve both.

I made a PR #35 to address this.

@mr-ns
Copy link

mr-ns commented Feb 23, 2023

Yes, please please please export the client field in Session. Alternatively, provide a way to set Session.client that does not require login (as happens via CreateClient()...Connect()). Here is my use case:

I am calling the Zabbix user.checkAuthentication API, which means (like the OP) I already have an existing API token. Because I am not logging in I cannot use the CreateClient()...Connect() approach to acquire a Session. Normally I would just create a new instance of Session, however in my particular case Zabbix is using a self-signed cert so I need to slip in a custom http.Client with InsecureSkipVerify = true. Because Session.client is not exported I have no way to do this.

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

No branches or pull requests

2 participants