FORGEBOX Enterprise 🚀 - Take your ColdFusion (CFML) Development to Modern Times! Learn More...

Coldbox Module to allow Social Login via Github

v1.0.5 Public

Coldbox Module to allow Social Login via Github

Setup & Installation

Add the following structure to Coldbox.cfc

github = {
    oauth = {
        loginSuccess        = "login.success",
        loginFailure        = "login.failure",
        clientID            = "{{github_provided_clientID}}",
        clientSecret        = "{{github_provided_clientSecret}}",
        redirectURL         = "{{where_the_user_will_land_after_redirect}}",
        scope               = "user,user:email"
    }
}

Interception Point

If you want to capture any data from a successful login, use the interception point twitterLoginSuccess. Inside the interceptData structure will contain all the provided data from twitter for the specific user.

An example interception could look like this

component {
    function githubLoginSuccess(event,interceptData){
        var queryService = new query(sql="SELECT roles,email,password FROM user WHERE githubUserID = :id;");
            queryService.addParam(name="id",value=interceptData['id']);
        var lookup = queryService.execute().getResult();
        if( lookup.recordCount ){
            login {
                loginuser name=lookup.email password=lookup.password roles=lookup.roles;
            };
        }else{
            // create new user
        }
    }
}
v1.0.5 - structure upgrades b/c of changes to layout
v1.0.0 - initial release

Here are all the versions for this package. Please note that you can leverage CommandBox package versioning to install any package you like. Please refer to our managing package version guide for more information.

Version Created Last Update Published By Stable Actions
Current
1.0.5 Feb 19 2015 08:43 AM Jun 09 2016 01:17 AM

 

$ box install nsg-module-github

No collaborators yet.
 
  • Feb 19 2015 08:43 AM
  • Jun 09 2016 01:17 AM
  • 1,460
  • 952
  • 6