Closed MuhammadElmahi closed 1 year ago
Hey @MuhammadElmahi! Sorry that you're having issues with the package. Please could you show me the code you're using that's giving this error? And could you please also let me know which version of the package you're using? 🙂
Hey @ash-jc-allen – thanks for the great library!
I'm running into this too – I'm on v7.0.1
. This is the code that's failing:
use AshAllenDesign\LaravelExchangeRates\Classes\ExchangeRate;
$ratesProvider = app(ExchangeRate::class);
$rates = $ratesProvider->exchangeRate('USD', 'GBP');
// HTTP request returned status code 401:
// {"error":{"code":"invalid_access_key","message":"You have not supplied a valid API Access Key. [Technical Support: suppo (truncated...).
Hey @jlevers! Sorry that you're having the same issue. Please can you let me know which API service you're using so I can check it out 🙂
I was using exchangeratesapi.io. I'm on the free tier, in case that's relevant.
Thanks for the extra info @jlevers, I'll try and take a look at this soon. Just to double-check, please can you confirm that you have the correct API key set in the .env
file? 🙂
Yep, double-checked the key and it's correct...but I just tested this again this morning and got a different error:
{
"success":false,
"error": {
"code":105,
"type":"base_currency_access_restricted"
}
}
This one makes a bit more sense, as apparently exchangeratesapi.io doesn't allow you to use all base currencies on the free plan (which I didn't realize till now). Not sure why I was getting the other error before...sorry for the false alarm.
Hey! It's no problem at all. I think all 3 of the APIs supported by this package are now all managed by the same company.
They seem to have recently put the exchangerate.host
API behind a paywall and require an API key to be passed in every request now too. So this has broken the driver for that API service (I'm currently fixing it).
And I think they've recently been tinkering with some of the features and plans. I've seen some reports from people on Twitter that had the same errors the other day.
I'm going to close this issue for the time being because I think the problem was with the API and it should hopefully be working again now. But if this is still affecting you (or anyone else), please let me know and I'll take a look 😄
Hello, When trying to get the output it gives me this api error
Client error:
GET http://api.exchangeratesapi.io/v1//latest?access_key=%7Bce7e75f2bbb3079c0aeeca8bb64816e5%7D&base=USD&symbols=SAR
resulted in a401 Unauthorized
response: {"error":{"code":"invalid_access_key","message":"You have not supplied a valid API Access Key. [Technical Support: suppo (truncated...) (View: /home/user/website.com/resources/views/home.blade.php) .I wrote the API correctly from exchangeratesapi.io, And for implementation I just Added this code to .env folder EXCHANGE_RATES_API_KEY={my-api}