Library http://golang.org/x/oauth2 There is a ClientID, ClientSecret and access token which I get with my hands. It is necessary to implement the function

buildOAuthHTTPClient(scope string) (*http.Client, error) 

There is an implementation only with receipt via the browser.

 config := &oauth2.Config{ ClientID: cfg.Installed.ClientID, ClientSecret: cfg.Installed.ClientSecret, Scopes: []string{scope}, Endpoint: oauth2.Endpoint{ AuthURL: cfg.Installed.AuthURI, TokenURL: cfg.Installed.TokenURI, }, RedirectURL: redirectUri, } config.Client(oauth2.NoContext, token) 

Who already dealt with this library help please.

    1 answer 1

    Scope determines the scope of access token . If the token is already there, then why call a function that receives scope at the input?
    Implement a client that sends a token in the header and that's it.

    If you don’t need OAuth 2.0 in general, but its particular use case with the Youtube API , then here is a lot of code on the subject.
    https://developers.google.com/youtube/v3/code_samples/go