-
Notifications
You must be signed in to change notification settings - Fork 343
New command: cli accesstoken refresh
#6681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
How does the new command address this problem? Is it, because it allows you to refresh all access tokens?
I think it's confusing to have 2 access token-related commands in two different namespaces. My gut feeling tells me that it would make sense to consolidate them under |
Yes, just like when you use
Does this mean that you want to move |
That's not quite true. The token will get the latest tokens from the service principal. If you've updated the app reg, but haven't reconsented, you'll still miss the latest addition.
If we decide to build this new command, then I suggest we consider it. We can of course do it gradually with an alias+deprecation first and removal in the next major. |
Yes, that's true, but that's the responsibility of the user in my opinion. |
@milanholemans i like the idea and I also support the idea of moving both to the CLI command group. One thing: if I'm using |
Correct, but we need to clearly manage the expectations that at the end of the day we depend on what's on the service principal, not app reg, so we can't magically return all scopes if they haven't been consented first 😅
They're identical. The only difference is, that refresh can refresh all tokens at once, while |
I think @martinlingstuyl questions what the difference would be between |
One more idea... going back to the reason behind this proposal:
So it's not about access tokens, it's about auth. So should this command be named |
Good point waldek, we also have a We could also add it on the connection command: |
I'm not really a fan of |
Yeah, this would definitely be a useful command. I was testing some of our SPE commands and tweaking my app reg, and having a quick way to refresh all tokens after adding scopes would’ve come in handy. +1 for keeping it in the |
Uh oh!
There was an error while loading. Please reload this page.
Usage
m365 cli accesstoken refresh
Description
Refreshes all cached access tokens
Options
-r, --resource [resource]
Examples
Refreshes all cached access tokens
Refresh only a SharePoint access token
Default properties
No response
Additional Info
Just like we do for util accesstoken get, let's support
sharepoint
andgraph
as resources.Where does this idea come from? In the past, I've been fiddling with access tokens quite a lot. Adding and removing access tokens from the app registration to check whether or not I have enough permissions to perform a specific action. This is not so easy since an acquired access token remains valid for one hour by default, and these tokens are used by CLI until they expire. The only solution is, logging out and back in again, or using
util accesstoken get -r sharepoint --new
for example. While the last method is easy for Graph and SharePoint (the most common resources), it becomes harder for other APIs since their resource name is not that common anymore.After creating command #6657, it's cool that we can now update the app registration to run all commands in CLI, but we suffer again from the same cached access token issue. Therefore, I suggest that we create a command that refreshes all, or a specific access token, to make things easier.
I suggest that command #6657 should also reference this new command so people are not scratching their heads as to why their new permission scope is not working.
The text was updated successfully, but these errors were encountered: