GitHub authorisation problem in app

I’ve been working through the Advanced Node and Express - Implementation of Social Authentication III lesson. My code passes the test but when I click on the ‘Login with Github’ link I get the following error

TypeError: Cannot read property ‘0’ of undefined…

I can’t figure out what the issue is so any assistance would be appreciated

Commenting out the following lines in my GithubStrategy seems to fix the problem but I’m not sure why. This code was given by FCC so any ideas why it returns an error?

//photo:[0].value || "",
//email: profile.emails[0].value || "No public email",

Ok I figured it out. My email was set as private in GitHub and I didn’t have an app photo uploaded