codecombat/app/lib/GitHubHandler.coffee

23 lines
732 B
CoffeeScript
Raw Normal View History

2014-08-15 10:20:45 -04:00
CocoClass = require 'lib/CocoClass'
{me} = require 'lib/auth'
storage = require 'lib/storage'
module.exports = class GitHubHandler extends CocoClass
scopes: 'user:email'
subscriptions:
'github-login': 'commenceGitHubLogin'
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: ->
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)