Showing socially shared content to users who are not logged in

Almost all the content on my webapp/site is visible only after the viewer has logged in. But, when a user shares a piece of content with someone (who may or may not be a user of the app), that someone receives a link, and expects that clicking on the link will show them the content.

So I need to balance two needs - 1) the assumption (please confirm if this is valid) that directly showing content on clicking a shared link is better UX and 2) the app itself needs to be behind a login/sign-up wall.

What are some good approaches to go about this?

I should also note that for people who aren't yet users, the signup process is extremely simple and almost the same as logging in: there are 3 fields - name, email, password, fill them up, touch the button and you are directly signed up and logged in. So no confirmation links, etc.