Wiring in a Dusk/Dawn sensor to my porch light
On the sensor black should be LINE, the ungrounded (hot) feed.  Red should be LOAD, the supply to the light. White should be neutral, and green is ground.  

The black wire coming into the box, should be the ungrounded  (hot) feed (likely from a switch).  The white wire should be neutral, and green/bare is ground.


Connect all the grounds together, and to the box if it's metal.
Connect the white coming into the box, to the white from the light and sensor.
Connect the black coming into the box, to the black on the sensor. 
Connect the red from the sensor, to the black from the light.