Skip to main content
edited tags
Link
SPQuestion
  • 151
  • 2
  • 8
deleted 50 characters in body
Source Link
SPQuestion
  • 151
  • 2
  • 8

I'm working with the following:

  • Azure MVC app (using organisational authentication with Azure AD)
  • WebAPI (within the MVC project)
  • SharePoint Online

MVC => API

I would like to use AJAX to communicate between the MVC page and the WebAPI rather than server postbacks. I'd also like to make the WebAPI available for other services that don't use the MVC portion of the app for future extensibility (e.g. PowerApps). As I understand it, I need to use ADAL.js to authenticate between the MVC page and the WebAPI rather than relying on passing authentication cookies in AJAX requests (as these time out frequently and this is not the recommended approach).

API => SPO

When the WebAPI receives an authenticated AJAX request from the MVC page, it should communicate with SharePoint Online - for example to update list items. Consent should be organisation-level rather than user-level.

In order to communicate with SharePoint, I need to get a ClientContext object, which I think is possible via the helper methods in OfficeDev PnP AuthenticationManager, provided I can get hold of an access token. Can I somehow retrieve an access token from the WebAPI controller context (as I have already authenticated with AzureAD via ADAL.js at this point in order to access the WebAPI) or do I need to use ADAL.NET to retrieve an access tokenuse ADAL.NET to retrieve an access token?

Thanks!


EDIT: It looks like Kirk Evans' blog post covers this scenario - I will test and see if I can get it working

I'm working with the following:

  • Azure MVC app (using organisational authentication with Azure AD)
  • WebAPI (within the MVC project)
  • SharePoint Online

MVC => API

I would like to use AJAX to communicate between the MVC page and the WebAPI rather than server postbacks. I'd also like to make the WebAPI available for other services that don't use the MVC portion of the app for future extensibility (e.g. PowerApps). As I understand it, I need to use ADAL.js to authenticate between the MVC page and the WebAPI rather than relying on passing authentication cookies in AJAX requests (as these time out frequently and this is not the recommended approach).

API => SPO

When the WebAPI receives an authenticated AJAX request from the MVC page, it should communicate with SharePoint Online - for example to update list items. Consent should be organisation-level rather than user-level.

In order to communicate with SharePoint, I need to get a ClientContext object, which I think is possible via the helper methods in OfficeDev PnP AuthenticationManager, provided I can get hold of an access token. Can I somehow retrieve an access token from the WebAPI controller context (as I have already authenticated with AzureAD via ADAL.js at this point in order to access the WebAPI) or do I need to use ADAL.NET to retrieve an access token?

Thanks!

I'm working with the following:

  • Azure MVC app (using organisational authentication with Azure AD)
  • WebAPI (within the MVC project)
  • SharePoint Online

MVC => API

I would like to use AJAX to communicate between the MVC page and the WebAPI rather than server postbacks. I'd also like to make the WebAPI available for other services that don't use the MVC portion of the app for future extensibility (e.g. PowerApps). As I understand it, I need to use ADAL.js to authenticate between the MVC page and the WebAPI rather than relying on passing authentication cookies in AJAX requests (as these time out frequently and this is not the recommended approach).

API => SPO

When the WebAPI receives an authenticated AJAX request from the MVC page, it should communicate with SharePoint Online - for example to update list items. Consent should be organisation-level rather than user-level.

In order to communicate with SharePoint, I need to get a ClientContext object, which I think is possible via the helper methods in OfficeDev PnP AuthenticationManager, provided I can get hold of an access token. Can I somehow retrieve an access token from the WebAPI controller context (as I have already authenticated with AzureAD via ADAL.js at this point in order to access the WebAPI) or do I need to use ADAL.NET to retrieve an access token?

Thanks!


EDIT: It looks like Kirk Evans' blog post covers this scenario - I will test and see if I can get it working

deleted 14 characters in body
Source Link
SPQuestion
  • 151
  • 2
  • 8

I'm working with the following:

  • Azure MVC app (using organisational authentication with Azure AD)
  • WebAPI (within the MVC project)
  • SharePoint Online

MVC => API

I would like to use AJAX to communicate between the MVC page and the WebAPI rather than server postbacks. I'd also like to make the WebAPI available for other services that don't use the MVC portion of the app for future extensibility (e.g. PowerApps). As I understand it, I need to use ADAL.js to authenticate between the MVC page and the WebAPI rather than relying on passing authentication cookies in AJAX requests (as these time out frequently and this is not the recommended approach).

API => SPO

When the WebAPI receives an authenticated AJAX request from the MVC page, it should communicate with SharePoint Online - for example to update list items. Consent should be organisation-level rather than user-level.

In order to communicate with SharePoint, I need to get a ClientContext object, which I think is possible via the helper methods in OfficeDev PnP AuthenticationManager, provided I can get hold of an access token. Can I somehow retrieve an access token from the WebAPI controller context (as I have already authenticated with AzureAD via ADAL.js at this point in order to access the WebAPI) or do I need to use ADAL.NET to retrieve an access token?

If the latter approach is required, do I need an app certificateuse ADAL.NET to retrieve an access token?

Thanks!

I'm working with the following:

  • Azure MVC app (using organisational authentication with Azure AD)
  • WebAPI (within the MVC project)
  • SharePoint Online

MVC => API

I would like to use AJAX to communicate between the MVC page and the WebAPI rather than server postbacks. I'd also like to make the WebAPI available for other services that don't use the MVC portion of the app for future extensibility (e.g. PowerApps). As I understand it, I need to use ADAL.js to authenticate between the MVC page and the WebAPI rather than relying on passing authentication cookies in AJAX requests (as these time out frequently and this is not the recommended approach).

API => SPO

When the WebAPI receives an authenticated AJAX request from the MVC page, it should communicate with SharePoint Online - for example to update list items. Consent should be organisation-level rather than user-level.

In order to communicate with SharePoint, I need to get a ClientContext object, which I think is possible via the helper methods in OfficeDev PnP AuthenticationManager, provided I can get hold of an access token. Can I somehow retrieve an access token from the WebAPI controller context (as I have already authenticated with AzureAD via ADAL.js at this point in order to access the WebAPI) or do I need to use ADAL.NET to retrieve an access token?

If the latter approach is required, do I need an app certificate?

Thanks!

I'm working with the following:

  • Azure MVC app (using organisational authentication with Azure AD)
  • WebAPI (within the MVC project)
  • SharePoint Online

MVC => API

I would like to use AJAX to communicate between the MVC page and the WebAPI rather than server postbacks. I'd also like to make the WebAPI available for other services that don't use the MVC portion of the app for future extensibility (e.g. PowerApps). As I understand it, I need to use ADAL.js to authenticate between the MVC page and the WebAPI rather than relying on passing authentication cookies in AJAX requests (as these time out frequently and this is not the recommended approach).

API => SPO

When the WebAPI receives an authenticated AJAX request from the MVC page, it should communicate with SharePoint Online - for example to update list items. Consent should be organisation-level rather than user-level.

In order to communicate with SharePoint, I need to get a ClientContext object, which I think is possible via the helper methods in OfficeDev PnP AuthenticationManager, provided I can get hold of an access token. Can I somehow retrieve an access token from the WebAPI controller context (as I have already authenticated with AzureAD via ADAL.js at this point in order to access the WebAPI) or do I need to use ADAL.NET to retrieve an access token?

Thanks!

Source Link
SPQuestion
  • 151
  • 2
  • 8
Loading