Mercurial > pumpbridge
comparison src/google.coffee @ 3:98a070c98982
add Twitter support
author | Mathias Gebbe <mgebbe@intevation.de> |
---|---|
date | Thu, 05 Jun 2014 18:02:25 +0200 |
parents | b73191efc65b |
children | f352c74a6a5b |
comparison
equal
deleted
inserted
replaced
2:e942a968cb52 | 3:98a070c98982 |
---|---|
1 # Copyright (C) 2014 by Intevation GmbH | 1 # Copyright (C) 2014 by Intevation GmbH |
2 # Author: Mathias Gebbe <mgebbe@intevation.de> | 2 # Author: Mathias Gebbe <mgebbe@intevation.de> |
3 # | 3 # |
4 # This file is Free Software under the Apache License, Version 2.0 | 4 # This file is Free Software under the Apache License, Version 2.0; |
5 # (the "License"); and comes with ABSOLUTELY NO WARRANTY! | 5 # and comes with NO WARRANTY! |
6 # You may not use this file except in compliance with the License. | 6 # See the documentation coming with pumpbridge for details. |
7 # See LICENSE for details. | |
8 | 7 |
9 https = require("https") | 8 https = require("https") |
10 async = require("async") | 9 async = require("async") |
11 _ = require("underscore") | 10 _ = require("underscore") |
12 Sync = require("./sync") | 11 Sync = require("./sync") |
193 return | 192 return |
194 | 193 |
195 getRefreshToken = (user, callback) -> | 194 getRefreshToken = (user, callback) -> |
196 if user.oauth_token.indexOf(';') isnt -1 | 195 if user.oauth_token.indexOf(';') isnt -1 |
197 token = user.oauth_token.substr(0,user.oauth_token.indexOf(';')) | 196 token = user.oauth_token.substr(0,user.oauth_token.indexOf(';')) |
197 code = user.oauth_token.substr(user.oauth_token.indexOf(';')+1 ,user.oauth_token.length) | |
198 else | 198 else |
199 token = user.oauth_token | 199 token = user.oauth_token |
200 code = user.oauth_token.substr(user.oauth_token.indexOf(';')+1 ,user.oauth_token.lenght) | |
201 data = "" | 200 data = "" |
202 post_data = querystring.stringify( | 201 post_data = querystring.stringify( |
203 "code": code | 202 "code": code |
204 "client_id": CLIENTID | 203 "client_id": CLIENTID |
205 "client_secret": CLIENTSECRET | 204 "client_secret": CLIENTSECRET |