My bosses force me to add an author to my paper who didn't contribute to it A, B — my current bosses. X — my ex-boss.

A — I've spent a semester on sabbatical at the institution of X. Here is some data I produce. You have to write 2 papers.

Me (after 3 month, working completely independent; I am on the stage of the scientific career that does not need any supervision) — Here is your paper (it will be probably submitted to a top journal).

B — Very good, only 2 corrections. Add this to the acknowledgements and X to the authors list.

Me — X contributed nothing to the work. Besides, (s)he has already taken advantage of my dfg project and made everything possible that (s)he becomes the formal supervisor of the phd student funded by my project (see this post). Why should I add (her)him? 

B — I need a paper with (her)him so that (s)he writes me a reference letter, don't you know I am looking for a prof. position.

A — You have to add X to the list of authors, haven't I told you that I spent a semester there. Besides, it is good for B's career. 

With uneasy mind I have done what I am told to do. My health is more precious to me... However, I am recurrently coming back to this issue. Have I done everything right?



Comments in response to questions (edited)

Thank you all for very active participation and numerous questions.
Unfortunately, I cannot provide more information as requested. The question can be closed as unclear, however, I do not want to reveal my identity.
There are a couple of clauses in your question which you may want to reconsider.


I worked completely independent &mdash; did you? You wrote a paper working on your own, which is indeed a big achievement. However, you've been working with data, and the data have been obtained by A in the lab run by X. This definitely does not sound like a completely independent work to me.
X contributed nothing to the work &mdash; did s/he not? They set up  and run a lab, where the data have been obtained. Could you write the same paper without the data A collected? Could A collect the data without X's lab?


The arguments above do not necessarily mean that X should co-author the paper, but this is a matter of agreement between all collaborators. In ideal world, this should be discussed before the project is started; in reality, discussions like you've had are often held too late into the process, and the frustration you're feeling is understandable. Be strong &mdash; you will be a completely independent researcher one day very soon, and hopefully you will manage your projects and relations in much more thoughtful and transparent way. Until then it is best not to waste your life in such battles.