2017 © Pedro PelĆ”ez
 

api auth-server-api

Auth Server API for PHP

image

spandansingh/auth-server-api

Auth Server API for PHP

  • Tuesday, May 26, 2015
  • by spandansingh
  • Repository
  • 1 Watchers
  • 0 Stars
  • 65 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Auth Server API

Build Status, (*1)

Auth Server API is a PHP HTTP client for Auth Server that makes it easy to send HTTP requests and trivial to integrate with web services., (*2)

  • Manages things like persistent connections, simplifies sending streaming POST requests with fields ,and abstracts away the underlying HTTP transport layer.
  • Set the cookie on your server by the token issued by the Auth Server
  • Easy login and logout function
  • Auth Server API makes it so that you no longer need to fool around with cURL options, stream contexts, or sockets for connecting with Auth Server.

Usage


$auth = new Auth\ApiClient(array( 'KEY' => AUTH_KEY, // YOUR AUTH KEY 'SECRET' => AUTH_SECRET, // YOUR AUTH SECRET 'LOGIN_URI' => '/login.php', // YOUR APP LOGIN URL ));

For Check Login Status

  • If the user is logged in, it returns the user information array.
  • If it is not logged in, it redirects to the auth server login page
$token = isset($_SESSION[ā€˜auth_server_token’])?$_SESSION[ā€˜auth_server_token’]:NULL ;  // If you save token in session than you can receive it like this .  

if($user = $auth -> isloggedIn($token)){
        echo ā€˜welcome’.$user[ā€˜first_name’].’’.$user[ā€˜last_name’];
 }     

For Login

$response = $auth -> dologin();
$token = $auth -> getToken();
$_SESSION[ā€˜auth_server_token’] = $token;
header(ā€˜location:’ , $auth ->getcallbackUri());  // After Saving token redirect to the callback_url() 
session_write_close();
. 

For Logout

unset($_SESSION['auth_server_token']);
$auth->doLogout();

Installing via Composer

The recommended way to install Auth Server API is through Composer., (*3)

# Install Composer
curl -sS https://getcomposer.org/installer | php

Next, run the Composer command to install the latest stable version of Auth Server API:, (*4)

composer require spandansingh/auth-server-api:dev-master

After installing, you need to require Composer's autoloader:, (*5)

require 'vendor/autoload.php';

Sample app

Check out Auth Server Demo App for a quick sample app., (*6)

Consultation

  • Spandan Singh
  • Looking for PHP web development solutions or consultation? Drop me a mail.

The Versions

26/05 2015

dev-master

9999999-dev https://github.com/spandansingh/auth-server-api

Auth Server API for PHP

  Sources   Download

The Requires

 

api vigyaa authserver

26/05 2015

dev-0b

dev-0b https://github.com/spandansingh/auth-server-api

Auth Server API for PHP

  Sources   Download

The Requires

 

api vigyaa authserver