codecombat/app/core/social-handlers/GitHubHandler.coffee

23 lines
750 B
CoffeeScript
Raw Normal View History

CocoClass = require 'core/CocoClass'
{me} = require 'core/auth'
storage = require 'core/storage'
2014-08-15 10:20:45 -04:00
module.exports = class GitHubHandler extends CocoClass
scopes: 'user:email'
subscriptions:
'auth:log-in-with-github': 'commenceGitHubLogin'
2014-08-15 10:20:45 -04:00
constructor: ->
super arguments...
@clientID = if application.isProduction() then '9b405bf5fb84590d1f02' else 'fd5c9d34eb171131bc87'
2014-08-26 11:37:11 -04:00
@redirectURI = if application.isProduction() then 'http://codecombat.com/github/auth_callback' else 'http://localhost:3000/github/auth_callback'
2014-08-15 10:20:45 -04:00
commenceGitHubLogin: (e) ->
2014-08-15 10:20:45 -04:00
request =
scope: @scopes
client_id: @clientID
2014-08-26 11:37:11 -04:00
redirect_uri: @redirectURI
2014-08-15 10:20:45 -04:00
location.href = "https://github.com/login/oauth/authorize?" + $.param(request)