auth_signature: Request Signing

auth_signatureR Documentation

Request Signing

Description

Requests against the last.fm API must be signed using the following algorithm as described in the API documenation.

A short description of the methodology is included here for completeness:

  1. Sort query parameters by key

  2. Create a single string with all parameters formatted as follows <key><value> using UTF-8 encoding,

  3. Append the Client Secret value (without a key),

  4. Hash the resulting string using a 32bit md5 hash

The signature is then added as extra parameter named api_sig.

These functions are not designed to be invoked directly. Requests are signed by default when using lastfm() and all other dependent raw and tidy endpoint functions.

  • add_signature() takes a list with request parameters and an auth_client signs it by adding the api_sig element.

  • create_signature() performs steps 1, 2, and 3

  • hash_signature() performs step 4

Usage

add_signature(params, auth_client)

create_signature(params, auth_client)

hash_signature(raw_signature)

Arguments

params

Named list of query parameters

Value

  • add_signature() returns a list

  • create_signature() and hash_signature() return strings


bkkkk/lastfmr documentation built on Sept. 4, 2022, 7:03 a.m.