JSPM

  • Created
  • Published
  • Downloads 422957
  • Score
    100M100P100Q203021F
  • License Apache-2.0

Sign a URL for Google Maps Platform requests.

Package Exports

  • @googlemaps/url-signature
  • @googlemaps/url-signature/dist/index.esm.js
  • @googlemaps/url-signature/dist/index.umd.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@googlemaps/url-signature) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Google Maps JavaScript URL Signing

npm Build Release codecov GitHub contributors semantic-release

Description

Sign a URL for Google Maps Platform requests.

Warning: It is not recommended to use this library in client side applications to avoid exposing the secret used to sign the URL.

Install

Available via npm as the package @googlemaps/url-signature.

npm i @googlemaps/url-signature

Documentation

Check out the reference documentation.

Example

Create a signature for a Google Maps request URL or url string.

const signature = createSignature("https://example.com/some-path?foo=bar", "secret");

Returns a new URL having a signature parameter.

const signedUrl = signUrl("https://example.com/some-path?foo=bar", "secret");
signedUrl.href; // "https://example.com/some-path?foo=bar&signature=..."

Create a signature for a path and query string using Hmac SHA1.

const signature = createSignatureForPathAndQuery("/some-path?foo=bar", "secret");

Note: This is not an officially supported Google product