Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7549223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:53:48+00:00 2026-05-30T09:53:48+00:00

Does anyone know how to properly authenticate an account using OAuth 2.0 and then

  • 0

Does anyone know how to properly authenticate an account using OAuth 2.0 and then use that auth token to access the user’s YouTube account?

At the end of http://code.google.com/apis/youtube/2.0/developers_guide_protocol_oauth2.html it says

The Google Data client libraries that support the YouTube Data API do not currently support OAuth 2.0. However, a newer set of Google API client libraries, which do not support the YouTube Data API, do provide OAuth 2.0 support.
As such, it is an option to use these newer libraries, which are listed below, for their OAuth 2.0 capabilities and then force the Google Data client library to use the OAuth 2.0 token(s) that you have obtained.

I have my application successfully running through the OAuth 2.0 process and I’m getting an access token which should be able to access youtube, but I don’t know how to “force the Google Data client library to use the OAuth 2.0 token(s)”.

Any example code would be great.

Liron

PS This is for a desktop application.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:53:50+00:00Added an answer on May 30, 2026 at 9:53 am

    Do do this you need to have both an account set up on google data apps (https://code.google.com/apis/console) and with the youtube apis (http://code.google.com/apis/youtube/dashboard).

    You then have to authenticate the google data api using their oauth mechanisms. Something like the following – this is gutted from some code we have.
    {code}

    //Create Client     
    m_Client = new NativeApplicationClient(GoogleAuthenticationServer.Description, m_ClientID, m_ClientSecret);
    //Add Youtube scope to requested scopes
    m_Scopes.Add("https://gdata.youtube.com");
    //Get Authentication URL
    authStateInitial = new AuthorizationState(m_Scopes);
    authStateInitial.Callback = new Uri(NativeApplicationClient.OutOfBandCallbackUrl);
    Uri authUri = m_Client.RequestUserAuthorization(authStateInitial);
    
    //Navigate to URL, authenticate get accessToken
    string accessToken = ...;
    
    string[] tokens = accessToken.Split(new char[] { '&' });
    if(tokens.Length == 2)
    {
      authStateFinal = new AuthorizationState(m_Scopes);
      authStateFinal.AccessToken = tokens[0];
      authStateFinal.RefreshToken = tokens[1];
    
      if(m_AuthStateInitial == null)
      {
        m_Client.RefreshToken(m_AuthStateFinal);
      }
      OAuth2Authenticator<NativeApplicationClient> authenticator = new OAuth2Authenticator<NativeApplicationClient>(m_Client, GetState); //GetState returns authStateInitial
      authenticator.LoadAccessToken();
    }
    

    Then you have to authenticate the youtube apis by using both the access token you got from above and the youtube Developer Key.
    {code}

        GAuthSubRequestFactory m_Authenticator = new GAuthSubRequestFactory(ServiceNames.YouTube, "Product Name");
        m_Authenticator.Token = AccessToken;
    
        YouTubeService m_YouTubeService = new YouTubeService(m_Authenticator.ApplicationName, m_DeveloperKey);
        m_YouTubeService.RequestFactory = m_Authenticator;
    

    Hope this helps someone.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know or have good links that explain what iPhone's event loop does
I have a .gz file that contains an XML document. Does anyone know how
does anyone know how to properly enable sorting on a rich:dataTable with columns generated
Short Version: Does anyone know how to do a simple date insert using Doctrine2?
Does anyone know how to configure durable queue on Terracotta server properly? Terracotta stores
Does anyone know why this is, or how to fix it? I'm using an
Does anyone know how to properly save/reuse macros recorded inside of a vim editor?
Does anyone know how this could properly be written in Django? {{ mu.expiry_date|default:{% trans
Does anyone know which property sets the text color for disabled control? I have
Does anyone know the format of the MAPI property PR_SEARCH_KEY ? The online documentation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.