Skip to content

Cannot access brand account's youtube channel #628

@markivancho

Description

@markivancho

I'm trying to use oauth flow to get access to youtube channels list. Everything works fine when I'm using my main default youtube channel, but when on consent screen I choose another channel that associated with google brand account I'm getting error in catch block (arguments -> {type: "tokenFailed", idpId: "google", error: "server_error"}), even though I gave access to everything asked.
Also, on https://myaccount.google.com/security it says that I gave access to application.

Here are some code snippets, I've tried different combinations of scope, prompt, access_type, but nothing successful

const googleScope = [
    'email',
    'profile',
    'openid',
    'https://www.googleapis.com/auth/youtube'
  ]

const googleOauthConfig = {
  client_id: GOOGLE_CLIENT_ID,
  fetch_basic_profile: true,
  ux_mode: 'popup',
  response_type: 'permission',
  access_type: 'offline',
  prompt: 'consent'
}

const loginGoogle = scope =>
  global.gapi &&
  global.gapi.auth2
    .getAuthInstance()
    .signIn({ ...googleOauthConfig, scope: scope.join(' ') })
    .then(res => {
      const authResponse = res.getAuthResponse()
      const { access_token } = authResponse

      return access_token
    })
    .catch(() => {

      throw new Error(POPUP_CLOSED_MESSAGE)
    })

In network there is failed request too

https://accounts.google.com/o/oauth2/iframerpc?action=issueToken&response_type=token%20id_token&login_hint=AJDLj6JUa8yxXrhHdWRHIV0S13cANzW1y8OtI22VrYqaEC2i73av3HLVph3WpN9U_HlWSNxCsiYTB2bXOl1-DWQmT0zrdSxGa1JR03gPm3hk1GCjY9-EQsDI5aEH73UEvOOCoqynaOnr&client_id=583558123459-oc3k39nd2i4cismo7gcvnsv12v03q6an.apps.googleusercontent.com&origin=http%3A%2F%2Flocalhost%3A4000&scope=openid%20profile%20email&ss_domain=http%3A%2F%2Flocalhost%3A4000
status - 403
response - { "error" : "invalid_request" } 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions