How to Solve hasScope Directive error : You are not authorized for this resource

I followed Will Lyon's tutorial on YouTube for adding hasScope and Authentication on YouTube here.

I added the hasScope to one of my custom mutations but I keep getting the error
Unhandled Rejection (Error): You are not authorized for this resource

This happens when I deploy to netlify using github.
I'm not sure what the issue is. Has anybody been able to get this to work?