Skip to content

3. Authentication

Valentinos Papasavvas edited this page Jul 29, 2023 · 2 revisions

To Integrate and use our endpoint, user need to grab the credentials and authentication themselves and working account should have sufficient balance on SMS.to to be able to send SMS or do Number Lookup. If you don't have already, please get one here.

After creation of account, user can generate credentials from here

Environment Variables

To use API Key for authentication

  • SMSTO_AUTH_MODE - api_key for e.g. SMST_AUTH_MODE=api_key
  • SMSTO_API_KEY - This is required to get connected with us

To use Oauth based authentication

  • SMSTO_AUTH_MODE - oauth for e.g. SMST_AUTH_MODE=oauth
  • SMSTO_CLIENT_ID - Provider Client ID obtained from sms.to
  • SMSTO_CLIENT_SECRET - Provider Secret obtained from sms.to
  • SMSTO_TOKEN_EXPIRE_TTL - By default the token is not expired. Set this variable in minutes if required the token to expire
  • SMSTO_TOKEN_AUTO_REFRESH - Setting the variable to true allows to auto refresh the access token
  • SMSTO_AUTO_REFRESH_OFFSET - Set this variable in seconds if auto_refresh is enabled

Setup for Laravel

The package is auto discovered. So after setting the environment variables in .env, user is able to use the functions provided by the SDK

Setup for Lumen

For Lumen, user need to enable Facade on file /bootstrap/app.php. Uncomment the line

$app->withFacades();

Then add service provider on same file

$app->register(\Intergo\SmsTo\SmsToServiceProvider::class);