Skip to content

Latest commit

 

History

History
24 lines (20 loc) · 885 Bytes

README.md

File metadata and controls

24 lines (20 loc) · 885 Bytes

CodeIgniter Github OAuth Authentication Library

Allows CodeIgniter to let users login to GitHub and gain access to their account data and the rest of GitHubs API.

Getting Started

  1. You first need to register your application with GitHub to get your client_id and client_secret
  2. Drag and drop the files in the respective folders (e.g. config/github.php goes into the config file in the CI application)
  3. Set the config variables
  4. Create button with link generated by $this->github->generateLoginURL()
  5. Create the redirect URI page, an example of how this could look is below:
  public function github_oauth(){
    $this->load->library('github');
    $token = $this->github->getAccessToken();
    
    if($token == false){
      //something went wrong
      redirect('login','refresh');
    }

    //save token somewhere safe
    redirect('','refresh');
  }