This is a simple question in itself, but when you takes stock the amount of different groups that people sort themselves into, and all of the different intricacies of those, then the answer becomes much more complex. First, though, let me say this: there is no objective measure for what gives you authority to write about something. If it turns out that you’re wrong about it, your audience will tell you.
Now, let’s talk about my personal experiences. Every time I’ve ever written any substantial text (with the caveat of putting effort into it, as I’ve absolutely mailed it in a few times), it’s been the product of hours of research. Although characters, as fictional creations, are easy to write in the sense that they don’t need to be a direct reflection of real-life people, the fact of the matter is that if they’re part of any certain group, whether my own or another, I’m going to do my best to give them justice through research, and, hopefully, some sort of interactions with real-life people.
An example: right now, I’m writing a story featuring Slavic characters. As a Slav, I already have some insight into how they’re going to act and how I want to represent them. But this is where we run into the tricky part: I would be lying through my teeth if I said I knew everything there is to know about the Slavic people* and who they’re likely to be. As a result, my answer is/was to research, As a result, I feel as if I absolutely have to authority to write about my “own group”, because I’ve put in the work to make the writing authentic.
Now, this is just for me. I can’t speak as to every single group, especially as race, gender, and nationality are totally separate things. What I can say is that you should never, ever other think in writing. If you’re right, it won’t matter. If you’re wrong, then you’ll know, because someone will make you aware. And if you’ve ever written about other groups confidently before, consider that logically, it should be easy writing about your own. Don’t waste your time alive worrying.
*And there are a lot of separate distinctions inside of that