How do you get the connection metadata in an Action?

In a rule I could do the following

const connectionMetadata: ArmoryConnectionMetadata = context.connectionMetadata || {}

In the actions I only see the following in the event.connection object

/** Connection */
declare type Connection = {
  /** The connection's unique identifier. */
  id: string
  /** The name of the connection used to authenticate the user (such as: `twitter` or `some-g-suite-domain`). */
  name: string
  /**
   * The type of connection.
   *
   * For social connection `connectionStrategy === connection`.
   * For enterprise connections, the strategy will be `waad` (Windows Azure AD), `ad` (Active Directory/LDAP), `auth0` (database connections), and so on.
   */
  strategy: string
}

Is there a global client around where I can grab the connection metadata with the connection id?

ex: rules had this global around

    await auth0.users.updateUserMetadata(user.user_id, {
      ...userMetadata,
      lastEnvId: requestedEnvironmentId
    })

Is there an auth0.connections.getConnection(connectionId) or something that can be used in an Action?

In the mean time, I am gonna add https://github.com/auth0/node-auth0 and the needed credentials via action secrets to get the metadata, but i’d much prefer if the connection metadata was in the event, just like it is in the rules.

Actions already have the app and user metadata but is only missing the connection metadata for some reason.

So I added auth0 and it’s adding a brutal amount of latency because it has to auth and get a token and then call the API, so that’s 2 new requests in the auth chain :frowning:

Pretty please, add connection metadata to the event :pray:


:point_up: with Actions ~2000 ms to authenticate


:point_up: with rules < half the time at ~900ms

@fieldju ,

Thanks for the feedback! I’ll pass the request along to the product team.

2 Likes

Thanks for trying out actions @fieldju! We’ll get event.connection.metadata added. It’s only missing due to an oversight on our end. Sorry about that!

Also, our hope is that in the future it should be pretty rare that you’ll need to use the Auth0 client in an action, but when you do, we’ll have better ways of providing it to you than relying on you to bootstrap it yourself. Stay tuned for that.

And thanks again for the awesome feedback!

3 Likes

@chris.geihsler is that a next sprint type of thing or a next quarter type of thing?

I implemented my workflow 2x, one with hooks + rules and the other with actions.
I am stashing the actions away on a branch for now, but would like to switch over to them one this is implemented because I like the UX of dev’ing actions better.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.