mcpField
U
using-backstage-identity

using-backstage-identity

github.com/vinzscamDevelopment444 installsUpdated 9w ago
Repository

About using-backstage-identity

using-backstage-identity is a skill for Backstage plugin development. It documents how to retrieve the current user's identity, profile, and ownership references, and how to call backend APIs as that user.

Key features

  1. 01Retrieve user entity references
  2. 02Read user profile information
  3. 03Get ownership entity references
  4. 04Use the current user's Backstage token

Use cases

  1. 01Display current user details in a plugin
  2. 02Filter resources by user ownership
  3. 03Call backend APIs as the current user
  4. 04Add identity handling to a scaffolded plugin

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/vinzscam/backstage-skills --skill using-backstage-identity

After installing, type/using-backstage-identityin Claude Code to confirm it loaded.

Bundled filesreferences/current-user.md

Details

From the project README

Backstage Identity Patterns

When to use this skill

  • Plugin needs the current user's entity ref (e.g. user:default/jdoe)
  • Plugin needs the user's profile info (display name, email, picture)
  • Plugin needs ownership entity refs to filter "things owned by me"
  • Plugin needs a Backstage token to call backend APIs as the current user

Choose the right pattern

SituationPatternReference
Get the current user (entity ref, ownership refs, profile)useApi(identityApiRef).getBackstageIdentity() / getProfileInfo()references/current-user.md

Two invocation modes

  • Standalone (mid-development): user is editing an existing plugin. Read the reference and apply the pattern to whichever component needs it.
  • Post-scaffold (called by creating-backstage-plugin): apply the pattern to a freshly scaffolded plugin. The reference's "Post-scaffold usage" section names exactly which file to edit and what to insert.

Common gotchas

  • identityApiRef is imported from @backstage/frontend-plugin-api in NFS plugins. (The same ref is also re-exported from @backstage/core-plugin-api for legacy compatibility — for new plugins always use the NFS package.)
  • getBackstageIdentity() is async and returns a BackstageUserIdentity — destructure userEntityRef and ownershipEntityRefs from it.
  • Don't store the result in a top-level variable; call from inside a hook (e.g. inside a React component or a useAsync callback) so it re-runs on identity change.

UI conventions

Use @backstage/ui for rendering when possible (Skeleton, Alert, Text, Flex, Button, …). See using-backstage-ui skill for the full component catalog and styling guidance.

Comments

Markdown supported