Problem/Motivation

The ApiClient class only loads the key ID from the Key module, but never retrieves the actual key value to use in API calls.
This can be mitigated by manually setting the key in the $config variable in settings.php.

Steps to reproduce

  1. Setup a key for the module using the key_select form element.
  2. Using a debugger or logs, check outgoing requests to the Point API and check the value of "x-api-key" in the request header, it will be the ID of the key as stored in the key module, but not the actual API key.
CommentFileSizeAuthor
#6 3271561-6.patch2.51 KBgordon
#2 load-api-key-3271561-2.patch2.02 KBeric115
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

    Comments

    Eric115 created an issue. See original summary.

    eric115’s picture

    StatusFileSize
    new2.02 KB

    Patch to update ApiClient constructor and associated service definition.

    I thought about throwing an exception in the constructor, but I think it might be better to allow it to be instantiated without an API key and to just let requests fail so that this doesn't break any existing uses of this module where an API key might not be set.

    mortim07’s picture

    @Eric115 Great pick up.

    mortim07’s picture

    @Eric115 I'd rather a custom exception be thrown within the constructor - the exception should reside under nsw_point_api and be something like InexistentKey.

    mortim07’s picture

    Status: Active » Needs work
    gordon’s picture

    StatusFileSize
    new2.51 KB

    Reroll the patch

    mortim07’s picture

    Status: Needs work » Fixed

    Status: Fixed » Closed (fixed)

    Automatically closed - issue fixed for 2 weeks with no activity.