npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@adobe/aio-lib-ims-oauth

v6.0.3

Published

OAuth2 (SUSI) token creation plugin for @adobe/aio-lib-ims

Downloads

41,059

Readme

OAuth support for Adobe I/O IMS Library

OAuth2 (SUSI) token creation plugin for aio-lib-ims.

Version Downloads/week Node.js CI Codecov Coverage License

This plugin is intended to be used in conjunction with the aio-lib-ims extending that to support browser based 3-legged OAuth2 authentication with IMS commonly known as SUSI flow.

For more information about the general setup of the Adobe I/O CLI IMS Plugin, please refer to aio-lib-ims.

The 3-legged OAuth2 requires interaction with a browser as the initial authentication step to receive the authorization code may be involving multiple browser based steps. For example an IMS Enterprise integration may involve further redirects to a 3rd party for actual authentication.

Workflow:

  1. A 4-byte random pass-code is generated
  2. A localhost web server is created, listening at a port number
  3. An Adobe I/O Runtime web action is opened in the browser, passing in this pass-code, the localhost web server port number, the client id, and the IMS scope as query parameters
  4. The Adobe I/O Runtime web action will redirect to the IMS authorization endpoint, with the scope, client id and a csrf token as the state property (derived from the id, client id, scope and localhost port) passed in as query parameters
  5. When the user is authenticated or an error occurs, the IMS endpoint will redirect to the Adobe I/O Runtime web action's login-success path
  6. If the authentication is successful, the Adobe I/O Runtime web action will redirect to the localhost web server at the specified port (derived from the state property), and forward the state and code properties to the localhost web server call as query parameters
  7. The localhost web server will pass on the authorization code to the library, and the library will call an IMS endpoint to exchange the authorization code for an access token and refresh token
  8. If the authentication is not successful, the Adobe I/O Runtime web action will report an error message in the web browser

The Adobe I/O Runtime function used (currently in testing) is coming soon.

Config

Add the oauth2 context into your .aio file in your current working directory (project folder), under ims:

{
  ims: {
    contexts: {
      oauth2: {
          client_id: "YOUR_CLIENT_ID",
          client_secret: "YOUR_CLIENT_SECRET",
          scope: "YOUR_IMS_SCOPE"
      }
    }
  }
}

The context can be named anything (here oauth2 is chosen for the context name).

Client ID

The Client ID (called the OAuth2 credential in Developer Console) must allow the Adobe I/O Runtime action's login-success path as the redirect URL. To this avail it should be configured as one of the redirect URI patterns of the OAuth2 credential in the Developer Console with the value:

https://aio-login\.adobeioruntime\.net/api/v1/web/default/applogin/login-success

Please note the backslash escaping of the dots in the URLs which is very important because this value must be a valid regular expression.

For example as shown in the following screenshot editing the credential:

Edit Credential

Contributing

Contributions are welcomed! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.