question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Introduce @me.id and @me.userName to simplify working with the current user

See original GitHub issue

Discussed in https://github.com/pnp/cli-microsoft365/discussions/3055

<div type='discussions-op-text'>

Originally posted by waldekmastykarz February 14, 2022 We have commands that require you to specify the user’s ID or name. Currently, there’s no way to easily specify information about the current user. There are some workarounds like retrieve the user name from the status command. If you need user’s ID you’d pass the name to the aad user get command. We could also consider custom implementations in the different commands to introduce specific options like --me. But this is all too cumbersome.

Since we have information about the current user already available in the access token, we could introduce tokens like @me.id and @me.userName that we’d replace with the corresponding information, similarly like we pass content from files. This would free us from having to have command-specific implementations and would make it easier to work with data specific to the current user.

What do you think @pnp/cli-for-microsoft-365-maintainers?</div>

This should be implemented just before we replace @ tokens with file contents: https://github.com/pnp/cli-microsoft365/blob/21e7f85ee4f6e0e77e3872bca56f11e70bcbb423/src/cli/Cli.ts#L165. In the implementation we need to consider both delegated and app-only auth. @me tokens should work only in delegated mode. In app-only auth they should be replaced with empty values to avoid considering appId a user ID.

Together with this change we should update docs and add a new section after https://pnp.github.io/cli-microsoft365/user-guide/using-cli/#passing-complex-content-into-cli-options that explains which tokens are available and how they can be used.

Checklist:

  • code
  • test
  • docs

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
plambercommented, Feb 19, 2022

I am going to pick this up

Read more comments on GitHub >

github_iconTop Results From Across the Web

Virtual In-Person Identity Proofing - ID.me
ID.me's identity platform provides best-in-class remote and in-person identity proofing capabilities for organizations across all sectors.
Read more >
ID.me Help Center
Identity Verification ID.me simplifies how you prove and share your identity online. The steps you take to verify depend on the partner you......
Read more >
ID.me: Digital Wallet, Identity Verification, and More
ID.me Wallet simplifies how individuals discover and access benefits and services through a single login and verified identity.
Read more >
Government Hub | ID.me
ID.me gives you one wallet to manage your digital identity. Get access to government benefits and services using your ID.me login.
Read more >
Terms of Service | ID.me
ID.me Wallet simplifies how individuals discover and access benefits and services through a single login and verified identity.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found