Download the PHP package affinidi/laravel-socialite-affinidi without Composer

On this page you can find all versions of the php package affinidi/laravel-socialite-affinidi. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-socialite-affinidi

Overview

AUGMENT EXPERIENCES WITH A SAFER, SIMPLER AND MORE PRIVATE WAY TO LOGIN

A paradigm shift in the registration and sign-in process, Affinidi Login is a game-changing solution for developers. With our revolutionary passwordless authentication solution your user's first sign-in doubles as their registration, and all the necessary data for onboarding can be requested during this streamlined sign-in/signup process. End users are in full control, ensuring that they consent to the information shared in a transparent and user-friendly manner. This streamlined approach empowers developers to create efficient user experiences with data integrity, enhanced security and privacy, and ensures compatibility with industry standards.

Passwordless Authentication Decentralised Identity Management Uses Latest Standards
Offers a secure and user-friendly alternative to traditional password-based authentication by eliminating passwords and thus removing the vulnerability to password-related attacks such as phishing and credential stuffing. Leverages OID4VP to enable users to control their data and digital identity, selectively share their credentials and authenticate themselves across multiple platforms and devices without relying on a centralised identity provider. Utilises OID4VP to enhance security of the authentication process by verifying user authenticity without the need for direct communication with the provider, reducing risk of tampering and ensuring data integrity.

Introduction

This package extends Socialite to enable passwordless authentication with the Affinidi OIDC provider.

Learn more about Laravel Socialite here

Quick Links

  1. Installation & Usage
  2. Create Affinidi Login Configuration
  3. Affinidi Login Integration with Sample Laravel project
  4. Affinidi Login Integration in Fresh Laravel Project
  5. Affinidi Login Integration in Existing Laravel Project

Installation & Basic Usage

To get started with Affinidi Socialite, follow these steps:

  1. Install the Affinidi Socialite package using Composer:

  2. Add the following configuration to your config/services.php file:

  3. Extend the setup of the Affinidi Socialite driver using our helper class in the boot() function of app\Providers\AppServiceProvider.php:

Authentication

To authenticate users using an OAuth provider, you will need two routes: one for redirecting the user to the OAuth provider, and another for receiving the callback from the provider after authentication.

The example routes below demonstrate the implementation of both routes:

Create Affinidi Login Configuration

Create the Login Configuration using Affinidi Dev Portal as illustrated here. You can given name as "Socialite App" and Redirect URIs as per your application specific e.g. "https:///login/affinidi/callback"

Important: Safeguard the Client ID and Client Secret and Issuer; you'll need them for setting up your environment variables. Remember, the Client Secret will be provided only once.

Note: By default Login Configuration will requests only Email VC, if you want to request email and profile VC, you can refer PEX query under (docs\loginConfig.json)[playground\example\docs\loginConfig.json] and execute the below affinidi CLI command to update PEX

Setup & Run application from playground folder

Open the directory playground/example in VS code or your favorite editor

  1. Install the dependencies by executing the below command in terminal

  2. Create the .env file in the sample application by running the following command

  3. Create Affinidi Login Configuration as mentioned here

  4. Update below environment variables in .env based on the auth credentials received from the Login Configuration created earlier:

    Sample values looks like below

  5. Run the application

  6. Open the http://localhost:8000/, which displays login page Important: You might error on redirect URL mismatch if you are using http://127.0.0.1:8000/ instead of http://localhost:8000/.
  7. Click on Affinidi Login button to initiate OIDC login flow with Affinidi Vault



Integration Affinidi Login - Fresh Laravel Project

If you want to start fresh without any base reference app, then you can follow the below steps

Create Laravel Project

Before creating your first Laravel project, you should ensure that your local machine has PHP and Composer installed.

  1. You may create a new Laravel project via the Composer create-project command

Note: If you enounter any issue on creating project like fileInfo, then you may have enable the fileInfo extension in your php.ini file like below

  1. After the project has been created, start Laravel's local development server using the Laravel's Artisan CLI serve command

  2. Once you have started the Artisan development server, your application will be accessible in your web browser at http://localhost:8000

Note: If you encounter an error on generating Key, then execute the below command which updates APP_KEY in your .env file and then run the app

Install Affinidi Socialite Provider

To get started with Socialite, use the Composer package manager to add the package to your project's dependencies

  1. Install Affinidi Socialite Library

  2. Open AppServiceProvider.php file under app\Providers, and bootstrap the Affinidi driver to socialite class inside function boot(), the code should look like below

  3. Add credentials for the Affinidi OIDC provider, should be placed in your application's config/services.php configuration file,

Use Affinidi Provider Inside Controller

  1. Create LoginRegisterController.php file under app\Http\Controllers, which has actions to perform normal login, logout, affinidi login and its callback, reference can be found here
  2. Open routes\web.php file and Add Web Routes which invokes the above login controller actions, reference can be found here
  3. Create file login.blade.php under resources\views for adding Affinidi Login button, reference can be found here
  4. Create dashboard dashboard.blade.php under resources\views for displaying the logged in user info, reference can be found here

Run the application

  1. Run the application

  2. Open the http://localhost:8000/, which displays login page Important: You might error on redirect URL mismatch if you are using http://127.0.0.1:8000/ instead of http://localhost:8000/.
  3. Click on Affinidi Login button to initiate OIDC login flow with Affinidi Vault




Integration Affinidi Login to existing Laravel Project

If you want to integrate Affinidi Login to any existing PHP Laravel Application using socialite, then you can follow the below steps

Install Affinidi Socialite Provider

To get started with Socialite, use the Composer package manager to add the package to your project's dependencies

  1. Install Affinidi Socialite Library

  2. Open AppServiceProvider.php file under app\Providers, and bootrap the affinidi driver to socialite class inside function boot(), the code should look like below

  3. Add credentials for the Affinidi OIDC provider, should be placed in your application's config/services.php configuration file,

  4. Create the Login Configuration as per step here

  5. Update below environment variables in .env based on the auth credentials obtained from the previous step

PROVIDER_CLIENT_ID="" PROVIDER_CLIENT_SECRET="" PROVIDER_ISSUER=""

  1. Add the Affinidi Login button in your login page, reference can be found here

  2. Use socialite driver as 'affinidi' in route handler / controller, reference controller can be found here

Run the application

  1. Run the application

  2. Open the http://localhost:8000/, which displays login page Important: You might error on redirect URL mismatch if you are using http://127.0.0.1:8000/ instead of http://localhost:8000/.
  3. Click on Affinidi Login button to initiate OIDC login flow with Affinidi Vault

Call Affinidi APIs

For example, if you want to issue a VC


All versions of laravel-socialite-affinidi with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
laravel/socialite Version ^5.10
firebase/php-jwt Version ^6.10
guzzlehttp/guzzle Version ^7.8
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package affinidi/laravel-socialite-affinidi contains the following files

Loading the files please wait ....