scribe-node
Version:
Scribe java OAuth library port to node.js
18 lines (14 loc) • 972 B
text/coffeescript
scribe = require('./scribe').load(['GoogleApi'])
get_authorization_url = (service) ->\
request_token_extract = (response) ->\
# request token should be saved somewhere because service.getAccessToken uses request token\
# but here we just print it on console, where you can take tokens and save inside get_request_token function\
request_token = service.api.getRequestTokenExtractor() response.data\
console.log request_token\
url = service.getAuthorizationUrl request_token\
# as it is with request token, also url is printed to the console which you need to\
# copy and paste to browser to retrieve the verification code\
console.log "\nAuthorization url: "+url\
service.getRequestToken request_token_extract
service = new scribe.ServiceBuilder().provider(scribe.GoogleApi).apiKey('www.articlemanager.us').apiSecret('tD_FisW209w4ZRyE-ZoQwn8J')._scope('https://www.google.com/analytics/feeds/').build()
get_authorization_url service