ICMJE (guidelines used by many medical journals) recommends that authorship be based on these criteria:
Read the full recommendations.
Best practices
Some journals require you to denote author roles - use the CRediT Taxonomy.
Most journals allow you to acknowledge non-author contributors.
Dance A. Authorship: Who's on first?. Nature. 2012;489(7417):591-593. doi:10.1038/nj7417-591a
Your article has been accepted for publication in a journal and you want it to have the widest possible distribution and impact.
In the "traditional" publishing model, the author signs over copyright to the journal publisher. So... you may not have free access to your article, if you don't subscribe to the journal. Read more
You would never knowingly keep your research from a readership that could benefit from it, but signing a restrictive publication agreement limits your scholarly universe and lessens your impact as an author.
Why? According to the traditional publication agreement, all rights —including copyright — go to the journal. You probably want to include sections of your article in later works. You might want to give copies to your class or distribute it among colleagues. And you likely want to place it on your Web page or in an online repository if you had the choice. These are all ways to give your research wide exposure and fulfill your goals as a scholar, but they are inhibited by the traditional agreement. If you sign on the publisher’s dotted line, is there any way to retain these critical rights?
Yes. The SPARC Author Addendum is a legal instrument that modifies the publisher’s agreement and allows you to keep key rights to your articles. The Author Addendum is a free resource developed by SPARC in partnership with Creative Commons and Science Commons, established non-profit organizations that offer a range of copyright options for many different creative endeavors.