Closed bilalswiftsolutions closed 4 years ago
This package currently stores the credentials in the cache, it could be that your cache is getting automatically expunged.
What cache driver are you using?
we are using default laravel cache.
it means that when we run command like php artisan cache:clear
or php artisan config:clear
then we need to reconnect xero ?
config:clear should be fine, but yes, cache:clear will definitely wipe it.
If you have any ideas on a different place to store the keys please let me know.
In my Opinion credentials should be stored in database instead of cache . so we can load it any time. and also we can update it with reconnection
Second solution
add a config file for them which loads them from the .env file. You can largely mimic the database credential infrastructural for this. This allows you to isolate the information in a single file, and keep them out of git completely. It also allows you to modify them per environment if you have a separate endpoint and/or credentials for the api which you can use in local or any uat environments.
.env:
THIRD_PARTY_API_USERNAME=test
THIRD_PARTY_API_PASSWORD=test
config/third-party.php
<?php
return [
'username' => env('THIRD_PARTY_API_USERNAME', null),
'password' => env('THIRD_PARTY_API_password', null),
];
usage:
$password = config('third_party.username');
Storing the keys in the .env file wouldn't work as we'd need write access to the .env file. Same for any config files. We could potentially store it in a json file under storage but I'd prefer not to.
A database table could work that ties in with issue #8 Closing this issue in favour of storing it there. Please :+1: that issue.
We have Integrated Xero with our app . but it gets disconnected any time automatically . what could be the reason? We are not storing zero credentials in database . do we need to do that?