0.0.5 • Published 8 months ago

@forge/auth v0.0.5

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
8 months ago

Forge authorization

This package provides methods for app developers to authorize users and entities (issues, pages, etc.) before making asApp product REST API calls.

Example usage in Connect

A small adapter around AP.request to get this library working in Connect apps:

    const authorize = authorizeConfluenceWithFetch((url, { body }) => {
        const res = new Promise((resolve) => {
          addon.httpClient(req).post(
            {
              headers: {
                'X-Atlassian-Token': 'no-check',
                'Content-Type': 'application/json',
              },
              url,
              body,
            },
            (err, response, body) => {
              if (err || response.statusCode >= 400) {
                // read response and reject
              } else {
                resolve(JSON.parse(body));
              }
            },
          );
        });
        return res;
      });

    authorize('5c35519ce6047225b6d54c23')
      .onConfluenceContent(309755905)
      .canUpdate()
      .then((checkResult /* true / false */) => {
        // handle
      }

The consumer would need to handle errors bubbled up from the fetch helper and the @forge/auth library.

0.0.3

10 months ago

0.0.5

8 months ago

0.0.5-next.0

9 months ago

0.0.4

9 months ago

0.0.3-next.0

10 months ago

0.0.4-next.1

9 months ago

0.0.4-next.0

9 months ago

0.0.2

11 months ago

0.0.2-next.0

11 months ago

0.0.1

3 years ago

0.0.1-next.2

3 years ago

0.0.1-next.1

3 years ago

0.0.1-next.0

3 years ago