Can I hang a swing from 2 by 8 roof beams?
The problem with the pipe idea is that unless you're going to run it at an angle, you'd never be able to get a pipe through several consecutive rafters.

You may actually be OK with lag screws - a properly installed 3/8 lag screw  should provide an enormous amount of withdrawal resistance.  Here's a sample chart from Masco:1



I wouldn't be horribly concerned about the roof members, as long as you are attaching where they have full thickness and minimize the distance of the cantilever. 

Your most likely points of failure are going to be the chains (see this answer), or the hardware on the swing itself. In general, working with rated fasteners installed they way they were intended to be used is a better idea than "winging it".

Note that I have no idea of the condition or construction quality of where you intend to hang your swing to, and I am not a structural engineer.

1 Not to be taken as a product endorsement or as representative of other similar products. You will always want to check the ratings of the hardware that you actually intend to install.