Skip to content
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

Simplify login in the CLI #889

Closed
waldekmastykarz opened this issue Mar 25, 2019 · 5 comments

Comments

@waldekmastykarz
Copy link
Member

commented Mar 25, 2019

We should simplify logging in to Office 365 so that there is only one login command. Instead of having to login to each API separately (eg. spo login, graph login, azmgmt login) you would login once in the CLI and then each command would use the Multi-Resource Refresh Token to obtain access token it needs. Internally all retrieved tokens would be stored the same way they are being stored now so that there is minimal overhead in executing commands and once retrieved tokens can be reused until they expire. Retrieving SharePoint URL requires additional consideration because each tenant has a unique URL as opposite to services such as Microsoft Graph or Azure AD Graph.

This change makes it easier to work with the CLI because it doesn't require users to sign in separately to each command.

This is a breaking change which will be included in v2 of the CLI.

  • implement o365-wide login, logout and status commands
  • centralize persisting login information
  • fix lazy loading of commands
  • automatically retrieve access token necessary for the particular HTTP request
  • update all commands
  • update command help and docs
  • update docs about using custom AAD apps and that at minimum it has to have permissions to read SharePoint sites or SPO URL discovery will fail and SPO commands won't work
  • update user manual
  • update MPA (if necessary)
  • update PR checklist

@waldekmastykarz waldekmastykarz self-assigned this Mar 25, 2019

@waldekmastykarz waldekmastykarz added this to the v2.0 milestone Mar 25, 2019

@waldekmastykarz waldekmastykarz added the v2 label Mar 25, 2019

@waldekmastykarz waldekmastykarz changed the title Simplify login Simplify login in the CLI Mar 25, 2019

@waldekmastykarz

This comment has been minimized.

Copy link
Member Author

commented Mar 27, 2019

Work in progress available here: https://github.com/waldekmastykarz/office365-cli/tree/v2-login

To see how it's working:

  • $ o365 login
  • $ o365 graph teams list
  • $ o365 spo app list

Right now, only graph teams list and spo app list have been refactored to use the new login. I will add a few more commands to verify all is working as expected.

@waldekmastykarz waldekmastykarz moved this from Backlog to In progress in Update / enhancement CLI commands Mar 27, 2019

@waldekmastykarz

This comment has been minimized.

Copy link
Member Author

commented Apr 7, 2019

Another thing that we need to verify is that lazy-loading commands keeps working as intended. Currently we have some logic implemented that tries to find the corresponding command class based on the length of args and if we simplify _service_ login to just login it could cause some side effects.

@waldekmastykarz

This comment has been minimized.

Copy link
Member Author

commented Apr 22, 2019

To implement simplified login in the CLI, we'll need to update most, if not all, commands because many have dependencies on things like auth.service, auth.site.url, etc. - things that are affected by this change. As we'll be updating commands anyway, I wonder if it wouldn't make sense to already implement automatically retrieving the necessary access token for the particular request to avoid having to go through all of them twice.

@waldekmastykarz

This comment has been minimized.

Copy link
Member Author

commented Apr 22, 2019

I've added an example of how automatically retrieving access tokens, SPO (admin) URL and tenant ID would look like. See the following commands for example:

  • spo app list - working with SPO
  • spo cdn get - working with tenant ID
  • spo storageentity set - working with tenant admin site
  • graph teams list - command on MS Graph
@waldekmastykarz

This comment has been minimized.

Copy link
Member Author

commented May 16, 2019

All commands and tests have been refactored to use the new login system. Next stop, docs.

waldekmastykarz added a commit to waldekmastykarz/office365-cli that referenced this issue May 17, 2019
waldekmastykarz added a commit to waldekmastykarz/office365-cli that referenced this issue May 17, 2019

@waldekmastykarz waldekmastykarz moved this from In progress to Done (merged) in Update / enhancement CLI commands May 17, 2019

waldekmastykarz added a commit that referenced this issue May 18, 2019
waldekmastykarz added a commit that referenced this issue May 25, 2019
waldekmastykarz added a commit that referenced this issue Jun 2, 2019
waldekmastykarz added a commit that referenced this issue Jun 3, 2019
waldekmastykarz added a commit that referenced this issue Jun 9, 2019
VelinGeorgiev pushed a commit to VelinGeorgiev/office365-cli that referenced this issue Jun 14, 2019
waldekmastykarz added a commit that referenced this issue Jun 17, 2019
waldekmastykarz added a commit that referenced this issue Jun 18, 2019
waldekmastykarz added a commit that referenced this issue Jun 24, 2019
waldekmastykarz added a commit that referenced this issue Jun 30, 2019
VelinGeorgiev added a commit to VelinGeorgiev/office365-cli that referenced this issue Jul 26, 2019
VelinGeorgiev added a commit to VelinGeorgiev/office365-cli that referenced this issue Aug 15, 2019
VelinGeorgiev added a commit to VelinGeorgiev/office365-cli that referenced this issue Aug 15, 2019
YannickRe added a commit to YannickRe/office365-cli that referenced this issue Aug 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.