PHPackages                             ncit/efaas-socialite - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. ncit/efaas-socialite

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

ncit/efaas-socialite
====================

eFaas Provider for Laravel Socialite

1.0.0(2y ago)02171MITPHPPHP &gt;=7.2

Since Jul 6Pushed 2y ago2 watchersCompare

[ Source](https://github.com/ncit-mv/efaas-socialite)[ Packagist](https://packagist.org/packages/ncit/efaas-socialite)[ Docs](https://github.com/ncit/efaas-socialite)[ RSS](/packages/ncit-efaas-socialite/feed)WikiDiscussions main Synced yesterday

READMEChangelog (1)Dependencies (5)Versions (2)Used By (0)

eFaas Laravel Socialite
=======================

[](#efaas-laravel-socialite)

[Laravel Socialite](https://github.com/laravel/socialite) Provider for [eFaas](https://efaas.gov.mv/).

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

[](#installation)

You can install the package via composer:

```
composer require ncit/efaas-socialite
```

**Laravel 5.5** and above uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.

After updating composer, add the ServiceProvider to the providers array in config/app.php

```
Ncit\Efaas\Socialite\Providers\EfaasSocialiteServiceProvider::class,
```

### Add configuration to `config/services.php`

[](#add-configuration-to-configservicesphp)

```
'efaas' => [
    'client_id' => env('EFAAS_CLIENT_ID'),
    'client_secret' => env('EFAAS_CLIENT_SECRET'),
    'redirect' => env('EFAAS_CLIENT_REDIRECT_URI'),
    'server_url' => env('EFAAS_URL', 'https://efaas.gov.mv/connect'),
],
```

### Usage

[](#usage)

You should now be able to use the provider like you would regularly use Socialite (assuming you have the facade installed): Refer to the [Official Social Docs](https://laravel.com/docs/8.x/socialite#routing) for more info.

**Warning:** If you get `403 Forbidden` error when your Laravel app makes requests to the eFaas authorization endpoints, request NCIT to whitelist your server IP.

```
//efaas default scopes are openid and efaas.profile
return Socialite::driver('efaas')->redirect();

//to get extra scopes pass other scopes on scopes methods
return Socialite::driver('efaas')->scopes([
    'openid',
    'efaas.profile',
    'efaas.email',
    'efaas.mobile',
    'efaas.passport_number',
    'efaas.country',
    'efaas.work_permit_status',
    'efaas.photo'
])->redirect();
```

and in your callback handler, you can access the user data like so.

```
$efaasUser = Socialite::driver('efaas')->user();
$accessToken = $efaasUser->token;

```

#### Logging out the eFaas User

[](#logging-out-the-efaas-user)

In your Laravel logout redirect, redirect with the provider `logOut()` method using the access token saved during login

```
return Socialite::driver('efaas')->logOut($access_token, $post_logout_redirect_url);
```

#### Using eFaas One-tap Login

[](#using-efaas-one-tap-login)

This package will automatically add an /efaas-one-tap-login endpoint to your web routes which will redirect to eFaas with the eFaas login code.

Sometimes you may wish to customize the routes defined by the Efaas Provider. To achieve this, you first need to ignore the routes registered by Efaas Provider by adding `EfaasProvider::ignoreRoutes` to the register method of your application's `AppServiceProvider`:

```
use Ncit\Efaas\EfaasProvider;

/**
 * Register any application services.
 */
public function register(): void
{
    EfaasProvider::ignoreRoutes();
}
```

Then, you may copy the routes defined by Efaas Provider in [its routes file](/routes/web.php) to your application's routes/web.php file and modify them to your liking:

```
Route::group([
    'as' => 'efaas.',
    'namespace' => '\Ncit\Efaas\Http\Controllers',
], function () {
    // Efaas routes...
});
```

#### Authenticating from mobile apps

[](#authenticating-from-mobile-apps)

To authenticate users from mobile apps, redirect to the eFaas login screen through a Web View on the mobile app. Then intercept the `code` (authorization code) from eFaas after they redirect you back to your website after logging in to eFaas.

Once your mobile app receives the auth code, send the code to your API endpoint. You can then get the eFaas user details from your server side using the auth code as follows:

```
$efaas_user = Socialite::driver('efaas')->userFromCode($code);
```

After you receive the eFaas user, you can then issue your own access token or API key according to whatever authentication scheme you use for your API.

#### Changing the eFaas login prompt behaviour

[](#changing-the-efaas-login-prompt-behaviour)

The eFaas login prompt behaviour can be customized by modifying the prompt option on your redirect request

```
return Socialite::driver('efaas')->with(['prompt' => 'select_account'])->redirect();
```

The available prompt options are:

OptionDescription**`login`**Forces the user to enter their credentials on that request, regardless of whether the user is already logged into eFaas.**`none`**Opposite of the `login` option. Ensures that the user isn't presented with any interactive prompt. If the request can't be completed silently by using single-sign on, the Microsoft identity platform returns an interaction\_required error.**`consent`**Triggers the OAuth consent dialog after the user signs in, asking the user to grant permissions to the app.**`select_account`**Interrupts the single sign-on, providing account selection experience listing all the accounts either in session or any remembered account or an option to choose to use a different account altogether#### Available properties for eFaas User

[](#available-properties-for-efaas-user)

```
$id_number = $efaasUser->username;
```

#### All Available eFaas data fields

[](#all-available-efaas-data-fields)

FieldDescription**`id`**Efaas User Identifier**`name`**Full Name**`first_name`**First Name**`middle_name`**Middle Name**`last_name`**Last Name**`name_dhivehi`**Full Name In dhivehi**`first_name_dhivehi`**First name in Dhivehi**`middle_name_dhivehi`**Middle name in Dhivehi**`last_name_dhivehi`**Last name in Dhivehi**`user_type`**User type
1- Maldivian
2- Work Permit Holder
3- Foreigners**`username`**ID number in case of maldivian and workpermit number in case of expatriates**`birthdate`**Date of birth. (Carbon instance)**`gender`**Gender**`email`**Email address**`mobile`**Registered phone number**`photo`**User photo**`passport_number`**Passport number of the individual (expat and foreigners only)**`is_workpermit_active`**Is the work permit active**`permanentAddress`**Permananet Address. Country will contain an ISO 3 Digit country code.**`country`**user Country name**`countryCode`**user Country Code**`is_verified`**Whether User is verified or Not**`verification_type`**user verification type**`updated_at`**Information Last Updated date. (Carbon instance)### Testing

[](#testing)

```
composer test
```

### Changelog

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Javaabu Pvt. Ltd.](https://github.com/javaabu)
- [Arushad Ahmed (@dash8x)](http://arushad.org)
- [Mohamed Jailam](http://github.com/muhammedjailam)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1093d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/affda219758a191ad2386d7c5402c3b4ff52a197d4c3461e3598f3aa0cb6ef2d?d=identicon)[chipaau](/maintainers/chipaau)

---

Top Contributors

[![chipaau](https://avatars.githubusercontent.com/u/3242188?v=4)](https://github.com/chipaau "chipaau (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ncit-efaas-socialite/health.svg)

```
[![Health](https://phpackages.com/badges/ncit-efaas-socialite/health.svg)](https://phpackages.com/packages/ncit-efaas-socialite)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[illuminate/auth

The Illuminate Auth package.

10528.2M1.2k](/packages/illuminate-auth)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77022.3M151](/packages/laravel-mcp)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k90.5k1](/packages/mike-bronner-laravel-model-caching)[illuminate/routing

The Illuminate Routing package.

1419.2M3.0k](/packages/illuminate-routing)[spatie/laravel-export

Create a static site bundle from a Laravel app

674146.0k6](/packages/spatie-laravel-export)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
