I'm currently using Meilisearch and I need to get the uid of an API key that I am using. I'm calling their getKey() method with an API key to get information about this key, but I notice that there is no uid field in the response, despite seeing the field in the responses in their docs. Did they change the response to getKey? How can I obtain the uid of an API key?
Meilisearch documentation only reflects the latest version of Meilisearch, which is v0.28. The uid field for keys was introduced in v0.28, so chances are you are using an older Meilisearch version.
Related
I'm trying to create an app that uses drf-api-key for authorization. And I want to monitor which api key used in every connection used to database, Is there a way to that?
I tried to get the value of headers.get("Authorization") I get a none value, I just want to retrieve the name of api key used or the prefix of it.
You can simply get the token using:
token = request.auth
I figured it out by using
apiKey = request.headers['X-Api-Key'].split('.')[0]
I intermittently get the error; even while using API Key with my request (distance-matrix api), does anyone have a solution?
"Keyless access to Google Maps Platform is deprecated. Please use an API key with all your API calls to avoid service interruption. for further details please refer to http://g.co/dev/maps-no-account."
Looks like we have an answer, the developer had typed in param for key as "Key" in of the server configs and the reason for the resulting error –
I'm having a hard time sorting out how to make Nexmo use custom settings from $notifiable i.e. App\User while sending out notifications. Laravel by default expects the Nexmo config (API key, secret) to be set in services.php and Nexmo driver uses the config from there directly. Although updating the config in runtime helps setting the values for the first time (if not set in services.php) but the same config values are used for all events. Ideally the config values should be used directly from the notifiable.
If I've understood the question correctly, you want to use your customer's API key and secret rather than using a single value for all customers.
If you'd like to use multiple API keys and secrets you'll need to use nexmo/client directly (github repo):
$client = new Nexmo\Client(new Nexmo\Client\Credentials\Basic(API_KEY, API_SECRET));
You can fetch the credentials from the database and add the client instance to the container by writing your own small service provider. Here's the one that nexmo/laravel uses. This one is complicated as it has to support every possible authentication combination.
/via https://github.com/Nexmo/nexmo-laravel/issues/27
I keep getting invalidSearchFilter error when using YouTube API v3. I have the following params:
part: snippet
q: testtag
forMine: true
type: video
I am using the API playground, and noticed that if I do an OAuth call, it will work, but with just the API key (Execute without OAuth), it fails. Same thing happens in my code. A basic list call works in both, so I am suspecting a bug in their API, or I'm missing something.
Can anyone else confirm this to see if I'm missing something?
It works if I leave off the forMine and type params, but then it searches globally, which is not what I want.
I have searched for this, and the only other references I've found have been related to not setting the type param, but I have it set.
I found this link which suggests a possible API bug: youtube v3 api error when searching with forMine set to false
The documentation is your friend Search: list
forMine boolean This parameter can only be used in a properly
authorized request. The forMine parameter restricts the search to only
retrieve videos owned by the authenticated user. If you set this
parameter to true, then the type parameter's value must also be set to
video.
So yes you are missing something the part where you can only use forMime type parameter with authorized requests. Using an Api key is an unauthorized request you are accessing the public API. How do you think it would be able to search videos that yours if you aren't authenticated? It doesn't know who you are.
I am using Restful api in CodeIgniter. Now I want to give api to third party, so I want to secure that api I am using digest, when I hit the api
in the browser a pop up comes which ask about username and password.
So I want to ask how to pass username and password in url to that it works.
Thank you in advance and sorry for the bad English
This doesn't directly answer you question but it does provide an alternative.
In my experience with API's you secure them with a HMAC. This is basically a hash that is generated using some data unique to the request, a timestamp and a private key. This hash along with the data used to create it will be passed to your API - NOT the private key - this data can all be sent in the headers of the request. When your API gets this data is uses the unique data, the timestamp and the private key to create another hash. The hash from the header and the newly created one are then compared. If they match you can be sure that the same private key was used to generate them. This saves sending any usernames/passwords over the internet.
I would also recommend that your server is setup to only serve HTTPS, this will help prevent man in the middle attacks.
This is a library that I have written for this very purpose.
https://packagist.org/packages/mardy-git/hmac
I hope this helps.