YouTube API, Version 3 on Rails

Thank you @bodrovis for this tutorial. Has helped me and the project I am working on tremendously.

I am running into an issue with the YouTube authentication however. This is the error I am getting:

A request to YouTube API was sent without a valid authentication: {"error"=>{"errors"=>[{"domain"=>"global", "reason"=>"authError", "message"=>"Invalid Credentials", "locationType"=>"header", "location"=>"Authorization"}],

According to the application trace this is coming from the upload! method in video_upload.rb; the access token seems to be inauthentic. I’m not exactly sure if this is the case or how to go about fixing it because it does work in some instances (e.g when the db is empty).

Any advice would be greatly appreciated. Thank you!