You're right both mean mean to require in a certain way, acording to RAE one of the meanings of
necesitar (to need), the way I've seen it being used is when asking for something or stating a need, but in a way like "requesting", while
exigir (according to RAE) is more "urgent" or "strong" if you will, like demanding/commanding or giving an order. Sometimes both can be used in the same context, but you could say
requerir is softer/more polite (and if it's to used in casual conversation, should be preferred if you're not too familiar with the other person) so you should use it in situations where you are requesting, while
exigir should be used when you're demanding something (often with a certain authoritarian sense).