{
  "name": "googleclientlogin",
  "description": "Log in to Google services using CllientLogin method",
  "url": "https://github.com/Ajnasz/GoogleClientLogin",
  "keywords": [
    "google",
    "service",
    "authentication",
    "api",
    "clientlogin"
  ],
  "repository": {
    "type": "git",
    "url": "git://github.com/Ajnasz/GoogleClientLogin.git"
  },
  "bugs": {
    "url": "https://github.com/Ajnasz/GoogleClientLogin/issues"
  },
  "engines": {
    "node": ">=0.4.1"
  },
  "author": {
    "name": "Lajos Koszti",
    "email": "ajnasz@ajnasz.hu",
    "url": "http://ajnasz.hu"
  },
  "version": "0.2.4",
  "readme": "Google's ClientLogin authentication implementation for Node.js\n\nRequires at least nodejs 0.4.1\n\nProperties:\n  errors: That is an object, filled with the possible error messages.\n  accountTypes: An object, where you can set the type of account to request authorization for.\n    properties are: google, hosted, hostedOrGoogle\n    default is hostedOrGoogle\n\nEvents:\n  login: emitted when login was success\n  error: emitted when an error occured. Has two parameters, the response object and the received data\n  You can access to their names via constants: GoogleClientLogin.events.login or GoogleClientLogin.events.error\n  or you can use 'login' and 'error' as string.\n\nMethods:\n  login\n    Starts the login process. It has one optional parameter, which should be an object with two properties:\n      logincaptcha, logintoken.\n      The logincaptcha is the user's answer to the captcha question\n      You will receive the logintoken if the login failed and the CaptchaRequired error code arrived\n    You must pass both the logincaptcha and logintoken if you must pass a captcha challange\n\n  getAuthId\n    Returns the value of the authId key from the response. If the login was success you will need to use this value to perform additional requests. You must put it into a the Authorization header like this:\n      'Authorization': 'GoogleLogin auth=' + googleAuth.getAuthId(),\n\n  getSID\n    Returns the value of SID key from the response.\n\n  getLSID\n    Returns the value of LSID key from the response.\n\n  isCaptchaRequired\n    If the login was not success and the user need to pass a captcha challenge this method will return true\n\n  getCaptchaUrl\n    Url of the captcha image\n\n  getCaptchaToken\n    You will need to pass it back to the google with the user's answer to the captcha if the login failed and captcha authentication required.\n\n  getError\n    If the login was not success, google will send back an error code what you can get with this method\n\n\nAfter the login was success, you should use the AuthId in each of your requests, see example below\n\nhttp://code.google.com/apis/gdata/faq.html#clientlogin\nlist of services:\n\n\nName                                                 |name in googleclientlogin module     |value\n-----------------------------------------------------|-------------------------------------|---------------\nGoogle Adwords APIs:                                 |adwords:                             |'adwords'\n-----------------------------------------------------|-------------------------------------|---------------\nGoogle Analytics Data APIs:                          |analytics:                           |'analytics'\n-----------------------------------------------------|-------------------------------------|---------------\nGoogle Apps APIs (Domain Information & Management):  |apps:                                |'apps'\n-----------------------------------------------------|-------------------------------------|---------------\nGoogle Base Data API:                                |base:                                |'gbase'\n-----------------------------------------------------|-------------------------------------|---------------\nGoogle Sites Data API:                               |sites:                               |'jotspot'\n-----------------------------------------------------|-------------------------------------|---------------\nBlogger Data API:                                    |blogger:                             |'blogger'\n-----------------------------------------------------|-------------------------------------|---------------\nBook Search Data API:                                |book:                                |'print'\n-----------------------------------------------------|-------------------------------------|---------------\nCalendar Data API:                                   |calendar:                            |'cl'\n-----------------------------------------------------|-------------------------------------|---------------\nGoogle Code Search Data API:                         |codesearch:                          |'codesearch'\n-----------------------------------------------------|-------------------------------------|---------------\nContacts Data API:                                   |contacts:                            |'cp'\n-----------------------------------------------------|-------------------------------------|---------------\nDocuments List Data API:                             |docs:                                |'writely'\n-----------------------------------------------------|-------------------------------------|---------------\nFinance Data API:                                    |finance:                             |'finance'\n-----------------------------------------------------|-------------------------------------|---------------\nGmail Atom feed:                                     |mail:                                |'mail'\n-----------------------------------------------------|-------------------------------------|---------------\nHealth Data API:                                     |health:                              |'health'\n-----------------------------------------------------|-------------------------------------|---------------\nHealth Data API H9 Sandbox                           |weaver:                              |'weaver'\n-----------------------------------------------------|-------------------------------------|---------------\nMaps Data APIs:                                      |maps:                                |'local'\n-----------------------------------------------------|-------------------------------------|---------------\nPicasa Web Albums Data API:                          |picasaweb:                           |'lh2'\n-----------------------------------------------------|-------------------------------------|---------------\nSidewiki Data API:                                   |sidewiki:                            |'annotateweb'\n-----------------------------------------------------|-------------------------------------|---------------\nSpreadsheets Data API:                               |spreadsheets:                        |'wise'\n-----------------------------------------------------|-------------------------------------|---------------\nWebmaster Tools API:                                 |webmastertools:                      |'sitemaps'\n-----------------------------------------------------|-------------------------------------|---------------\nYouTube Data API:                                    |youtube:                             |'youtube'\n-----------------------------------------------------|-------------------------------------|---------------\nC2DM Push Notification Service:                      |c2dm:                                |'ac2dm'\n-----------------------------------------------------|-------------------------------------|---------------\nGoogle Reader Data API (unofficial):                 |reader:                              |'reader'\n-----------------------------------------------------|-------------------------------------|---------------\nGoogle Voice API (unoffical):                        |voice:                               |'grandcentral'\n\n\nHow to use:\n\nvar GoogleClientLogin = import('googleclientlogin').GoogleClientLogin;\nvar googleAuth = new GoogleClientLogin({\n  email: 'yourmail@gmail.com',\n  password: 'yourpassword',\n  service: 'contacts',\n  accountType: GoogleClientLogin.accountTypes.google\n});\ngoogleAuth.on(GoogleClientLogin.events.login, function(){\n  // do things with google services\n  require('https').request({\n    host: 'www.google.com',\n    port: 443,\n    path: path,\n    method: 'GET',\n    headers: {\n      'Authorization': 'GoogleLogin auth=' + googleAuth.getAuthId(),\n      ...\n    }\n  });\n});\ngoogleAuth.on(GoogleClientLogin.events.error, function(e) {\n    switch(e.message) {\n      case GoogleClientLogin.errors.loginFailed:\n        if (this.isCaptchaRequired()) {\n          requestCaptchaFromUser(this.getCaptchaUrl(), this.getCaptchaToken());\n        } else {\n          requestLoginDetailsAgain();\n        }\n        break;\n      case GoogleClientLogin.errors.tokenMissing:\n      case GoogleClientLogin.errors.captchaMissing:\n        throw new Error('You must pass the both captcha token and the captcha')\n        break;\n    }\n    throw new Error('Unknown error');\n  // damn..\n});\ngoogleAuth.login();\n",
  "readmeFilename": "README",
  "_id": "googleclientlogin@0.2.4",
  "dist": {
    "shasum": "4e552c0bfef0859171b6edc2603eaf3afc6c1a61"
  },
  "_from": "googleclientlogin"
}
