Yep, I went through a big patch of not knowing who I was and I found it hard to make friends because I didn't feel like I quite had an identity I could show anyone. I mean how is somebody supposed to know you if you don't know yourself right?
So I started desperately searching, analysing, finding new perspectives to veiw things from and sifting through the world around me to try and find what resounded with me. I first found it was extremely hard for me to live without values and morals so they were the first things I started to build upon. I needed something to stick by and something to help form the base for my opinions. First start thinking of the things you do like, things you don't, things that stress you out and things that make you happy to see happening. Before I had started to pay close attention to how I reacted to things I hadn't realised that loyalty was a must for me, compassion, honesty... etc, etc. Though I reacted to the lack of these things I didn't have it in my head that, "ok, I value friends who are honest, loyal, etc" so I wasn't really looking very hard for people who fit my criteria and so people were stomping on me left, right and centre because I'd only start looking at them after I'd let them in. Also they were taking a lot of my identity away from me each time I got hurt. This was me as a child and was probably where I started to form my INFJness. Before this it looked more like I was headed towards INFP.
But anyway once I had my values in place I started looking for friends who I could value and I was able to connect with them more deeply because I'd basically looked inside myself and renovated so I knew where most things stood. Then I started looking at my friends to see what in them I valued so much and whether it was applicable to me. This is where I started to form my independant and non-conformist ways.
After I'd done that, it was like I still couldn't understand myself. I had thoroughly organised my outer shell but I still didn't feel complete within. I still didn't know what I wanted and I still hadn't found anyone to connect to on my deepest levels. So that's what got me into MBTI which really is helping me to fill in some big gaps. I'm starting to work out a lot more of how I work.
So what I'm trying to say is take a good look around yourself and try to relate everything back to yourself somehow, whether it's a nope that doesn't stick with me or a yep, I could really see myself living by that. Working out how you relate to the world is absolutely a big part of identity so really start to analyse and form opinions on as many things as you see necessary. Once you have your opinions set in motion, then your values and morals should follow. This is just what I found helped me a lot to get started. Who knows, maybe you're just going through a short term thing, to which I would say don't worry, it'll pass. I go through plenty of short patches of feeling lost. But if you're stuck in a ditch like I was the above is just what I did to get myself going.