kiss-fetch-auth
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

KISS-FETCH-AUTH

When fetching resources that require Authentication ...

import fetchAuthFactory from "kiss-fetch-auth"

const getAuthentication = () => {
    // As we are returning a promise, it can be as complex as required.
    return Promise.resolve('Bearer abcdefg')
}

const fetchAuth = fetchAuthFactory({
    auth: getAuthentication
})

// We can now use fetchAuth anywhere that we would have used FetchAPI.

const response = await fetchAuth('http://example.com/api/getSomething')

/kiss-fetch-auth/

    Package Sidebar

    Install

    npm i kiss-fetch-auth

    Weekly Downloads

    0

    Version

    0.0.4

    License

    ISC

    Unpacked Size

    6.31 kB

    Total Files

    13

    Last publish

    Collaborators

    • granson