PHPackages                             smskin/laravel-identity-service-client - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. smskin/laravel-identity-service-client

ActiveLibrary

smskin/laravel-identity-service-client
======================================

Guards for auth by identity service

032PHP

Since Jul 22Pushed 3y ago1 watchersCompare

[ Source](https://github.com/smskin/laravel-identity-service-client)[ Packagist](https://packagist.org/packages/smskin/laravel-identity-service-client)[ RSS](/packages/smskin-laravel-identity-service-client/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

About Identity service library
==============================

[](#about-identity-service-library)

Identity service is a service that allows you to organize authorization in a laravel application through a common remote server. This allows you to organize a multi-service architecture with end-to-end authorization.

Identity service library consists of 2 parts:

- identity service - Master auth service ()
- identity service client - this package. A client that allows application users to log in through a shared service

Installation
------------

[](#installation)

1. Run `composer require smskin/laravel-identity-service-client`
2. Run `php artisan vendor:publish --tag=identity-service-client`
3. Configure identity service client with `identity-service-client.php` in config folder and environments
4. Change create user table migration file
5. Run `php artisan migrate`

Migrations
----------

[](#migrations)

User will be creating automatically if user open site with correct jwt. You must change users table for support nullable fields.

I usually remove all columns except id and dates because they are not needed (authorization happens through a remote server). For example:

```
Schema::create('users', function (Blueprint $table) {
    $table->id();
    $table->string('name');
    $table->timestamps();
});
```

Environments
------------

[](#environments)

1. IDENTITY\_SERVICE\_CLIENT\_HOST - public address of identity service ()
2. IDENTITY\_SERVICE\_CLIENT\_DEBUG - debug mode of auth gates
3. IDENTITY\_SERVICE\_CLIENT\_API\_TOKEN - secret key for admin functionality (admin api - )

Configuration
-------------

[](#configuration)

You can configure library with `identity-service-client.php` file.

- classes
    - models
        - user - Class of User model. You can override it with your user model class. You must implement `HasIdentity` contract and implement `IdentityTrait` trait
- scopes
    - initial - initial jwt scope for receive basic user data
    - uses - array of scopes, that uses by this service (the service in which this library is installed). For example service for administrate identity service uses the `Scope::IDENTITY_SERVICE_LOGIN` scope

Example of Users model:

```
