Get info on logged in user in Chrome OS

1,810 views
Skip to first unread message

gmoz22

unread,
Jul 23, 2011, 11:23:36 PM7/23/11
to Chromium Apps
Hello!

Is there a way for an app to get information on the currently logged
in user on a Chromebook?
Just basic stuff like the first name, last name and email address.

Or is there another system of unique ID embedded that we can access
via Javascript?

Any tips would be greatly appreciated.

Thanks!

Frédérik Labbé

unread,
Jul 23, 2011, 11:57:42 PM7/23/11
to Chromium Apps
There's no built-in functions in chrome that you can use in javascript
to get the user name from the current session in the os. What you can
still do is a NPAPI Plugin that looks for the user name then include
it in your application. What it looks like :

<embed type="application/x-my-extension" id="pluginId">
<script>
var plugin = document.getElementById("pluginId");
var result = plugin.myPluginMethod(); // call a method in your
plugin
console.log("my plugin returned: " + result);
</script>

That's a brutal way to do it, since NPAPI Plugins have no restricted
access. In other words, if an NPAPI Plugin wants your computer to
explode, it does...

Documentation about programming NPAPI Plugins can be found here :
https://developer.mozilla.org/en/Plugins

Hope this help !

Frédérik Labbé

unread,
Jul 23, 2011, 11:59:55 PM7/23/11
to Chromium Apps
for documentation about how to include NPAPI Plugins in a chrome app :
http://code.google.com/chrome/extensions/npapi.html

On Jul 23, 11:23 pm, gmoz22 <gmo...@gmail.com> wrote:

Caleb Eggensperger

unread,
Jul 24, 2011, 12:11:57 AM7/24/11
to Frédérik Labbé, Chromium Apps
NPAPI plugins are not supported in Chrome OS:

http://groups.google.com/a/chromium.org/group/chromium-os-dev/browse_thread/thread/5a8a923b905807e4?pli=1

> --
> You received this message because you are subscribed to the Google Groups "Chromium Apps" group.
> To post to this group, send email to chromi...@chromium.org.
> To unsubscribe from this group, send email to chromium-app...@chromium.org.
> For more options, visit this group at http://groups.google.com/a/chromium.org/group/chromium-apps/?hl=en.
>
>

gmoz22

unread,
Jul 24, 2011, 8:59:41 AM7/24/11
to Chromium Apps

Thank you very much Frédérik for digging up all that info for me, and
thanks to Caleb for letting us know it won't work under Chrome OS.
I guess I have to use an OAuth or OpenID flow, and in that case I was
thinking of using OAuth 2.0.

In my app when the user installs the application on another
Chromebook, I need fetch his/her settings from my server.

So first I use the OAuth flow to get my access token, then I query one
of Google's API to get the user's email address, and hopefully at the
same time get its first name (probably its last name too :).
As I understand it there is no "accounts" scope, the "feeds" one seems
the less obtrusive and sufficient to let me tie the user's Google
account to my app.

At this stage, I am sure the user is who they say they are.
Then I have a bit of a problem because I never obtained a permanent
OAuth access token (expires_in=4301).

Do I have to pass the short-lived access token for each request to my
server, make my server check if the access token/email combo is
correct, tell the user to get another token if it expired, etc.?
Seems like I need to implement at least once a server-side flow, then
my server can generate my own encrypted key which will act as
permanent token, and store that on the client's side.
Since it's tied to the user's email address and it's also stored on my
server, I can use that for each request the user makes.
Any issues in this process, security or others?

Any recommendations on using OAuth 2.0 or on the whole flow of my app?
And if you have any links that explain how to implement JavaScript
OAuth 2.0 flow (other than http://code.google.com/apis/accounts/docs/OAuth2.html#CS),
don't hesitate to shoot them over ;)

Thanks a lot!

Trey Murdic

unread,
Mar 18, 2013, 4:54:00 PM3/18/13
to chromi...@chromium.org
can you use the chrome book to dev apps ?

Joe Marini

unread,
Mar 18, 2013, 5:33:34 PM3/18/13
to Trey Murdic, Chromium Apps
Sure, no reason why not. The chrome-app-samples repo on our Github has a code editor sample that I use to edit code on my CB all the time.



--
You received this message because you are subscribed to the Google Groups "Chromium Apps" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-app...@chromium.org.

To post to this group, send email to chromi...@chromium.org.
Reply all
Reply to author
Forward
0 new messages