Laravel
Laravel is a free, open-source PHP web framework. Intended for the development of web applications following the model–view–controller architectural pattern and based on Symfony.

Let's Get your Laravel App running with SAWO
🙌

Requirement

Steps:

1 SAWO Configuration
1.1. To use SAWO Login you would need an API key which can be obtained by creating a project in the sawo dashboard.
1.2. Once you create your project, you would need to set your project name and hostname. 1.2.1. For development in a local machine, the hostname should be set to 'localhost'.
If using ''localhost" as hostname is not working for you, try "127.0.0.1"
🤓
1.2.2. For production, the hostname should be set to your domain.
If you are adding your domain do not add 'https://', ''http://', 'www' or even trailing backslash. Example: https://dev.sawolabs.com/ should be kept as dev.sawolabs.com
1.3. Copy the API key from the project and keep it safe and secure.
The best practice to store your API key is to store values in .env so that they are not exposed.
2. Installation
To get started with Sawo, use the Composer package manager to add the package to your project's dependencies:
1
$ composer require sawolabs/sawo-laravel
Copied!
3. Configuration
3.1. Before using Sawo, you will need to add credentials for your application. These credentials should be placed in your application's config/sawo.php configuration file.
1
<?php
2
3
return [
4
/*
5
|--------------------------------------------------------------------------
6
| Configure Sawo defaults
7
|--------------------------------------------------------------------------
8
|
9
| Supported Identifier Types: "phone_number_sms", "email"
10
|
11
*/
12
13
'api_key' => env('SAWO_API_KEY', ''),
14
15
'api_secret_key' => env('SAWO_SECRET_KEY', ''),
16
17
'identifier_type' => env('SAWO_IDENTIFIER_TYPE', 'email'),
18
19
'redirect_url' => env('SAWO_REDIRECT', ''),
20
];
Copied!
3.2 Add the following in the .env file
1
SAWO_API_KEY=<YOUR_SAWO_API_KEY_HERE>
2
SAWO_SECRET_KEY=<YOUR_SAWO_SECRET_KEY_HERE>
3
SAWO_IDENTIFIER_TYPE=phone_number_sms
4
SAWO_REDIRECT=https://yourdomain.com/sawo/callback
Copied!
4. Add Sawo login form to blade template
Include the following code in your login blade template to show Sawo Auth dialog.
1
@include('sawo::auth')
Copied!
Once the SAWO SDK is successfully set up, a login form will be rendered in the provided container as displayed in the picture below:
Final Render of SAWO Login
Congratulations !! The SAWO API is now ready to be used in your Laravel application 🤘.

You can also check out SAWO's Laravel Sample Code.

It's okay, we get it! You got Stuck!
😞
Feel free to contact us on #ask-for-help on our Discord

Last modified 1mo ago