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

Auth exception when running spo customaction get when connected to tenant admin site #113

Closed
waldekmastykarz opened this issue Dec 15, 2017 · 2 comments

Comments

@waldekmastykarz
Copy link
Member

Expected behavior

Retrieve the information about the specified custom action located in the specified site no matter if you're connected to that site or to the tenant admin site.

Actual behavior

When connected to the tenant admin site, and trying to retrieve a custom action from a regular site using spo customaction get, the CLI throws the following error:

Error: 401 - {"error_description":"Exception of type 'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException' was thrown."}

CLI version

v0.3.0+

Additional information

This is caused by using ensureAccessToken to get the access token for the site:

https://github.com/SharePoint/office365-cli/blob/a771a94c162273162c6e7170be384c969066af99/src/o365/spo/commands/customaction/customaction-get.ts#L43

This method returns a fresh access token for the same resource as the connected site (tenant admin in this case). To get a valid access token for the specified site, instead the command should be using the getAccessToken method instead:

https://github.com/SharePoint/office365-cli/blob/c0f3ca598e04534cca8006f2143494abfd2beede/src/o365/spo/commands/app/app-install.ts#L37-L41

/cc: @VelinGeorgiev

@VelinGeorgiev
Copy link
Contributor

Will fix that soon. Thanks!

@waldekmastykarz
Copy link
Member Author

Cool! Thanks for picking it up!

VelinGeorgiev added a commit to VelinGeorgiev/office365-cli that referenced this issue Dec 16, 2017
adds detailed output solving pnp#93

docs typos fixes
@waldekmastykarz waldekmastykarz added this to the v0.4.0 milestone Dec 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants