scribe-node
Version:
Scribe java OAuth library port to node.js
40 lines (31 loc) • 1.2 kB
text/coffeescript
root = exports ? this
api = require('../scribe').DefaultApi20
# Google API 2.0
# Docs: http://code.google.com/apis/accounts/docs/OAuth2.html
# Register: https://code.google.com/apis/console/
class root.GoogleApi2 extends api
constructor: ->
= "https://accounts.google.com/o/oauth2/auth?response_type=code&"
= "https://accounts.google.com/o/oauth2/token"
getAccessTokenExtractor: ->
getAccessTokenEndpoint: ->
# is this same as access token endpoint for every provider, or do they even have expires_in?
getRefreshTokenEndpoint: ->
# access token and refresh token retrieval requires this
getAccessTokenVerb: ->
getRequestVerb: ->
getAuthorizationUrl: (config) ->
scope = 'scope=' + config.getScope() + '&'
client = 'client_id=' + config.getApiKey() + '&'
callback = 'redirect_uri=' + config.getCallback()
+ scope + client + callback
getHeaders: ->
headers = super
# retrieving access code Google requires this
headers['Content-Type'] = 'application/x-www-form-urlencoded'
headers