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

[alerta] token header prefix #1165

Open
allen13 opened this issue Feb 2, 2017 · 12 comments
Open

[alerta] token header prefix #1165

allen13 opened this issue Feb 2, 2017 · 12 comments

Comments

@allen13
Copy link

allen13 commented Feb 2, 2017

Back in December I merged a pull request that changed the alerta Authorization prefix from Bearer to Key because of an issue experienced by @emirozer #1076.

I was running a custom version of alerta at the time so I assumed that I had changed Bearer to Key myself. On further inspection I realized that alerta officialy started using the Bearer prefix a year ago. alerta/alerta@46e5209 which means @emirozer was using an older version of alerta.

I have been running a custom version of kapacitor for myself that uses Bearer so I haven't had any issues, but going forward there is a chance that someone will run into this again. I am proposing that the prefix be configurable. The default value would be Bearer.

I will work on a pull request in the coming days that addresses this. I will be sure to alert @emirozer if the pull request gets accepted.

@nathanielc
Copy link
Contributor

@allen13 Thanks for being proactive on this. I'll keep an eye out for the PR.

@allen13
Copy link
Author

allen13 commented Feb 3, 2017

@emirozer Once this commit goes through if you are still on the older version of alerta you can add this to your config:
[alerta]
token-prefix = "Key"

@allen13
Copy link
Author

allen13 commented Feb 7, 2017

Thanks getting this merged in so quickly @nathanielc!

@allen13 allen13 closed this as completed Feb 7, 2017
@v-zhuravlev
Copy link

v-zhuravlev commented Dec 18, 2017

Sorry, speaking about new and old alerta... I actually managed to get kapacitor+alerta running only after I used token-prefix ="Key". before that it was Alerta: Token is invalid error all the time.

And alerta version is 5.0.4 which is the latest and Kapacitor 1.3.3.

It doesn't work with token-prefix = "Bearer" or token-prefix = ""

@satterly
Copy link
Contributor

satterly commented Dec 21, 2017

I agree with @v-zhuravlev. Systems integrating with Alerta should use "Key <api-key>" in the Authorization header, not "Bearer". "Bearer" is reserved for user logins like the web UI and alerta command-line tool. I suggest you change the default token-prefix back to "Key".

@allen13
Copy link
Author

allen13 commented Dec 21, 2017

Whatever the latest default for alerta is should probably be the default here. This is more of an issue with the alerta project changing back and forth.

@allen13 allen13 reopened this Dec 21, 2017
@satterly
Copy link
Contributor

satterly commented Dec 21, 2017

@allen13 Just for the record, the Alerta authorization header has never changed. It was always "Key" for API keys and "Bearer" for the web UI.

@SebastianCzoch
Copy link

Hey, I've made PR because I spend some time why proper tokens are not working with Alerta on latest version of kapacitor (upgrade from 1.2 to 1.4).

Alerta doesn't work with Bearer, so it shouldn't be a default value.

@emirozer
Copy link

Thanks for notifying me in this thread, much appreciated.

Ping @pommi

@Edke
Copy link

Edke commented Jun 3, 2019

Any update of this or reason it was not merged yet ? Still Alerta's default prefix is Bearer which is wrong and without change of kapacitord's config Alerta integration is broken.

@lotooo
Copy link

lotooo commented Oct 18, 2019

I was going to prepare a PR cause I fell into the same trap. Can we get 👀 on #1753 and merge it cause the current default in kapacitor.conf is confusing.

@fajfer
Copy link

fajfer commented Nov 6, 2019

This is confusing, I'm a long time alerta and kapacitor user and I had to change my config to something like that to make it work: (doing that for all those lovely web search engine users)

kapacitor.conf

[alerta]
  enabled = true
  url = "http://alerta:8080/api"
  token = "myToken"
  token-prefix ="Key"
  environment = "Development"
  origin = "kapacitor"

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

No branches or pull requests

10 participants