authspire / AuthSpire-PHP

PHP API example for https://authspire.com licensing & auth system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


AuthSpire
AuthSpire

A FREE and secure licensing & authentication solution
using hybrid encryption.

Key FeaturesHow To UseAPI Functions

Key Features

  • License your software / application
    • Restrict access from other users and increase security
  • Manage Users
    • See who uses your application, set expiry dates for your licenses & more
  • Variables
    • Set custom hidden variables that are secured on our server and can not be cracked
  • Blacklists
    • Block users by IP or a Unique Identifier from accessing your application
  • Logging
    • Handle all logs and see what is happening inside of your application
  • Hybrid Encryption System
    • Encryption combined using AES 256 (Advanced Encryption Standard) and RSA to ensure the most security

How To Use

This piece of code uses phpseclib. The installation steps can be found on their page.

Create an account on the AuthSpire website. Create your application.

Name: Name of your application in the dashboard
UserID: UserID found in your account page
Secret: Secret of your application in the dashboard
Version: Version 1.0 by default (for updates change the version accordingly)
Public Key: Public Key for encryption found in the dashboard

<?php
  $app_name = "";     // Name of your application found in the dashboard
  $userid = "";      // ixwupMLC Your userid can be found in your account settings.
  $secret = ""; // Application secret found in the dashboard
  $currentVersion = "1.0"; // Current application version.
  $publicKey = ""; // Your public key for encryption.
?>

Functions

Initializing your application

Before using any other functions it is necessary to initialize your application with our server and retrieve all data. This can be done by calling this method in your main index.php file.

<?php
error_reporting(0);

include 'authspire.php';
include 'details.php';

session_start();

$authSpireAPI = new authSpire\api($app_name, $userid, $secret, $currentVersion, $publicKey);


if(!$_SESSION['initialized'])
{
  $authSpireAPI->init();
}

?>

Register a user

To register and add a new user to your application you will first require a valid license key which you can generate in your authspire dashboard in your selected application.

Register a user by calling this method and validate the registration

$authSpireAPI->register("username", "password", "license", "email");

Authenticate a user

To login and add retrieve all user data you can call this method

$authSpireAPI->login("username", "password");

Adding logs

Sometimes it is necessary to have an overview of what is going on inside your application. For that you can use logs

To add a log you can call this method.

$authSpireAPI->add_log("username", "action");

Getting Variables

You can store server-sided strings. Your application can then retrieve these strings with a secret key that will be generated in your panel when you generate your variable. This protects your strings from being decompiled or cracked.

$authSpireAPI->get_variable("secret");

Authenticate with only a license

Sometimes you want to keep it simple. A user can register/login with only using a license. For this you can use this function

$authSpireAPI->license("license");

License

MIT

About

PHP API example for https://authspire.com licensing & auth system

License:MIT License


Languages

Language:PHP 100.0%