Questions about Chrome Remote Desktop

617 views
Skip to first unread message

Phane Vagonette

unread,
Oct 14, 2015, 6:51:47 AM10/14/15
to Chromium-dev
Hello dear coders,

I've been suggested to try asking here after posting the same question in chromium-extensions.

Yesterday I started a quest following this guide.

I'm trying to build Chrome Remote Desktop host and the webapp from source, on a Windows 7 x64 machine.
I managed to build everything: service installer, shared lib, executables and the extension.

After loading the extension into the browser and starting it, it opens a tab in the browser: "chrome://chrome-signin/?source=5"
Logging in does not redirect me to the consent prompt, and it just takes me back to the login screen again, like the login never happened. (so I guess something is bad and I get logged out automatically)

The logs produced by the chrome extension:

Chromoting version: 48.0.2534.0 (v2)
console_wrapper.js:115 Native Message port disconnected host_daemon_facade.js:221remoting.ConsoleWrapper.recordAndLog_ @ console_wrapper.js:115
host_controller.js:27 Host version not available.
ui_mode.js:122 App mode: home
console_wrapper.js:115 Native Message port disconnected host_daemon_facade.js:221remoting.ConsoleWrapper.recordAndLog_ @ console_wrapper.js:115
crd_main.js:130 Pairing registry not supported by host.
extensions::lastError:133 Unchecked runtime.lastError while running identity.getAuthToken: OAuth2 request failed: Service responded with error: 'bad client id: {0}'
    at remoting.Identity.getToken (chrome-extension://ljacajndfccfgnfohlgkdphmbnpkjflk/identity.js:77:21)
    at remoting.Application.start (chrome-extension://ljacajndfccfgnfohlgkdphmbnpkjflk/application.js:68:21)
    at Object.remoting.startDesktopRemoting (chrome-extension://ljacajndfccfgnfohlgkdphmbnpkjflk/crd_main.js:182:16)
    at remoting.startDesktopRemotingForTesting (chrome-extension://ljacajndfccfgnfohlgkdphmbnpkjflk/crd_main.js:158:14)

I checked the OAuth2 remoting client id and remoting client id secret several times, even deleted + created new ones.
I set them as environment variables before building.
I also defined them in 'src/google_apis/google_api_keys.cc" as I found hinted in this document

Now, I realize there is hard to guess what the problem is, but any hints/opinions will be valuable.

This is my first contact with the chromium trunk and the build tools used by it, so I might have confused things.

Besides this,
  • What's the 'source' parameter for the page "chrome://chrome-signin" ?
  • How can I check that the OAuth2 credential is correct and works ?
  • I tried with both Chrome and Chromium, having the same result.
  • If I'm using my own OAuth2 credential for the extension, do I have to rebuild Chromium too ? (My guess was no, but better safe than sorry)
  • All documents I've read so far failed to make me understand why do I need the API key and how to use it. The links I pasted above don't mention creating one, but use one when setting up ~/.gyp/include.gypi.
  • Is the Chromoting API = Chrome Remote Desktop API ?

Sorry for the long post,
Potato!

Best of wishes

PS: Of course, any other info you might need, I'll be close. Also, if you want to build this on windows yourself and get stuck, I'll be close.

Lambros Lambrou

unread,
Oct 15, 2015, 5:12:37 PM10/15/15
to phane.v...@gmail.com, Chromium-dev
I'm not sure what could be causing this:
OAuth2 request failed: Service responded with error: 'bad client id: {0}'

If you do a search for "oauth2 tokeninfo endpoint", you can find some ways of examining the properties of an OAuth token.

You should have registered your own Developer Console project and obtained a Client ID and Secret (and set up any OAuth2 redirects) as explained in that guide you linked.
Those should make their way into the Chrome app that you built. Try unpacking the sources (or use the Chrome Developer tools to view the sources) - I think those keys end up in "plugin_settings.js". See if they are the same as you expect. The script at src/remoting/webapp/build-webapp.py is used to build the Chrome app.

I understand that the Chrome Identity API is used to obtain the OAuth token, which I'm not familiar with. So I don't know if it makes a difference whether you use a Chromium build or Google Chrome - they have different IDs/secrets baked in, but I'm not sure whether that's important in this case.


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Kelvin

unread,
Oct 15, 2015, 5:43:05 PM10/15/15
to Chromium-dev
Thank you for reaching out.
The guide that you are referring to is a bit out-dated.  I have submitted an update to the guide, which would be refreshed in a few days.

tl:dr;
We have changed how the client_id gets propagated to our app.

Use the following instructions instead to create your API key:
  1. Go to https://code.google.com/apis/console.
  2. Click on APIs & Auth > Credentails
  3. Click on "Add Credentials"
  4. Choose "OAuth 2.0 client ID"
  5. Choose "Chrome App"
  6. Under application id, enter ljacajndfccfgnfohlgkdphmbnpkjflk
  7. Click on "Create"
Use the following command instead to build the webapp:

  1. GOOGLE_CLIENT_ID_REMOTING_IDENTITY_API={client-id} ninja -C out/Release remoting_webapp

Your other questions are answered inline.  Let me know if you further questions.   

Kelvin

 I am not sure, my hunch is that it is indicating the sign in page is triggered from an web app 
  • How can I check that the OAuth2 credential is correct and works ?
If you follow the updated instructions, things should work.  
  • I tried with both Chrome and Chromium, having the same result.
  • If I'm using my own OAuth2 credential for the extension, do I have to rebuild Chromium too ? (My guess was no, but better safe than sorry)
 No, you don't.  You just need to rebuild the webapp (ninja -C out/Release remoting_webapp) 
  • All documents I've read so far failed to make me understand why do I need the API key and how to use it. The links I pasted above don't mention creating one, but use one when setting up ~/.gyp/include.gypi.
The Chrome Remote Desktop  web app relies on Google services under the hood to locate your hosts and connects to them.  The client id tells our backend service the identity of the app that is making the request, so that we can apply appropriate quota and audit usages.  
  • Is the Chromoting API = Chrome Remote Desktop API ?
For the most part, yes :)  Sorry for the confusion. 

Phane Vagonette

unread,
Oct 16, 2015, 6:06:58 AM10/16/15
to Chromium-dev
Hello again,

Thank you Kelvin & Lambros for your replies.
I managed to build it on both windows and mac os x.

Kelvin was right, the extension requires a Chrome App OAuth. It works after that.

I think the Web Application OAuth is not needed anymore. 
I manually replaced them with 'dummytoken' in '%repoRoot%/src/out/Release/plugin_settings.js' and the extension still works, so I guess they're deprecated.
I'll update this topic in case I find something else.

Some other notes, I'd update the documentation myself but I'm just the padawan:
- host build on Windows requires WiX installed, and manually modifying the path to it in common.gyp.
- host build on Mac OS X requires the 'packagesbuild' tool from Packages. This stage has to be ran manually. I saw no gyp file calling "do_signing.sh" from the mac installer folder.
Not having these will just fail to produce the host installer silently.

Best of wishes,
Andrei.
Reply all
Reply to author
Forward
0 new messages