HubSpot/hubspot-cli

Add command to display user info

miketalley opened this issue · 4 comments

Description and Context

Create a command (hs whoami for example) that prints information about the current user and portal.

Important: Display the scopes available to the user for the associated portal. This will be useful for debugging.

Hello, I tried adding this command, but I ran into a problem displaying the available scopes.
They aren't being saved to the hubspot.config.yml, but from my testing the scopes are available in packages/cli-lib/personalAccessKey.js from the token generated by getAccessToken.
Is there some reason they are not being passed further and saved to the config?

@kcmaxwell thanks for giving it a shot! The reason they are not saved to the config is because a user's available scopes can change in HubSpot. Writing them to the CLI config would mean that we'd have to continually check to make sure that they are up to date. Instead, we allow our internal system to keep track of them. Building this command will likely require hitting that auth endpoint and formatting the response in an easy to consume way.

@brandenrodgers Thanks for the advice! I was able to finish the command and created a pull request for it now.

Thanks so much for the help on this @kcmaxwell! It is now live on the latest beta release of the cli 4.0.1-beta.2 🎉