ERROR: Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
My code :
@client = Signet::OAuth2::Client.new( :authorization_uri => 'https://accounts.google.com/o/oauth2/auth', :token_credential_uri => 'https://oauth2.googleapis.com/token', :client_id => ENV['GMB_CLIENT_ID'], :client_secret => ENV['GMB_CLIENT_SECRET'], :scope => 'https://www.googleapis.com/auth/youtube.upload', :redirect_uri => 'https://localhost:4200/youtube' ) # a = my user with token and refresh token got from signet oAuth with google response = {"access_token" => a.token,"refresh_token" => a.refresh_token,"expries_in" => total_second,"scope" => "https://www.googleapis.com/auth/youtube.upload","token_type" => "Bearer" } @client.update!(response)@service ||= Google::Apis::YoutubeV3::YouTubeService.new@service.key = "my key"@service.authorization = @client #setting the authorization for apistatus = Google::Apis::YoutubeV3::VideoStatus.new( privacy_status: 'unlisted', ) snippet = Google::Apis::YoutubeV3::VideoSnippet.new( title: "My video", description: "description", ) video_object = Google::Apis::YoutubeV3::Video.new( status: status, snippet: snippet, ) @service.insert_video('id,snippet,status', video_object, notify_subscribers: true, content_type: 'video/webm', options: { authorization: @client } )Help needed to make it work. Authentication is not working