summaryrefslogtreecommitdiffstats
path: root/remoting/tools/gettoken.py
blob: 853d09bb2be2b8689ddf35538952181183db9e03 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python
#
# Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# gettoken.py can be used to get auth token from Gaia. It asks username and
# password and then prints token on the screen.

import urllib
import getpass
url = "https://www.google.com:443/accounts/ClientLogin"

print "Email:",
email = raw_input()

passwd = getpass.getpass("Password: ")

params = urllib.urlencode({'Email': email, 'Passwd': passwd,
                           'source': 'chromoting', 'service': 'chromiumsync',
                           'PersistentCookie': 'true', 'accountType': 'GOOGLE'})
f = urllib.urlopen(url, params);
print f.read()