Coauthorship in academic publications has two very important, distinct perspectives. One is a matter of scholarly principle, the other is a matter of scholarly politics.
Concerning scholarly principle, probably the most thoughtful and influential guidance on coauthorship is the authorship recommendations of the International Committee of Medical Journal Editors (often called the "Vancouver Protocol"). In summary:
2. Who Is an Author?
The ICMJE recommends that authorship be based on the following 4
criteria:
- Substantial contributions to the conception or design of the work; or the acquisition, analysis, or interpretation of data for the work;
AND
- Drafting the work or revising it critically for important intellectual content; AND
- Final approval of the version to be published; AND
- Agreement to be accountable for all aspects of the work in ensuring that questions related to the accuracy or integrity of any
part of the work are appropriately investigated and resolved.
In addition to being accountable for the parts of the work he or she
has done, an author should be able to identify which co-authors are
responsible for specific other parts of the work. In addition, authors
should have confidence in the integrity of the contributions of their
co-authors.
I personally strive to follow these principles in all my coauthorship. I recommend that you read the full document to develop a sense of what is appropriate.
However, especially as a PhD student, you must also pay carefully attention to scholarly politics. The reality is that not all of your supervisors, chairs, senior professors and so on will follow these principles--some of these people might not follow any of them at all. You need to learn to astutely navigate the institutional environment in which you find yourself. On one hand, you should never do anything that violates your own conscience. On the other hand, as a PhD student, some people who have direct power over you sometimes constrain you to do things that you are not confortable with and which you do not have the authority to oppose. (From my PhD days, I have a few publications with "coauthors" who certainly did not deserve it, but I and my fellow PhD student coauthors were powerless to do anything about it. However, since I became a professor, I do not tolerate any such nonsense on a publication where I am a coauthor.)
To take care of the politics, I recommend that you find a trusted mentor at your academic institution who knows the power plays going on among the people around you and whom you trust to advise you in your best interest. Such a mentor might or might not be your official supervisor. It would be wise to consult this mentor about any coauthorship decisions, such as this one you are asking here. However, politics or no politics, you need to always take care of your conscience.