Tuesday, August 13, 2019

Function APP Authentication



Azure Function APP Authentication  &  trigger this azure Function in SPFx webpart

Identity providers

App Service uses federated identity, in which a third-party identity provider manages the user identities and authentication flow for you. Five identity providers are available by default:
ProviderSign-in endpoint
Azure Active Directory/.auth/login/aad
Microsoft Account/.auth/login/microsoftaccount
Facebook/.auth/login/facebook
Google/.auth/login/google
Twitter/.auth/login/twitter





Reference Link :

https://docs.microsoft.com/en-us/azure/app-service/overview-authentication-authorization


and Call above function in SPFx webpart as below

public async _makeAzureCMRequest(): Promise<string>{
      return new Promise<string>((resolve, reject) => {
      const body: string = JSON.stringify({
        '_siteUrl': this.spfxContext.pageContext.web.absoluteUrl,
        '_pageItemID':this.spfxContext.pageContext.listItem.id
        });
     
        const requestHeaders: Headers = new Headers();
        requestHeaders.append('Content-type', 'application/json');
        requestHeaders.append('Cache-Control', 'no-cache');
      
        const httpClientOptions: IHttpClientOptions = {
          body: body,
          headers: requestHeaders
        };
      this.spfxContext.aadHttpClientFactory 
          .getClient(strings.clientId) 
          .then((client: AadHttpClient): void => { 
              client 
              .post(strings.azureContentAPI, AadHttpClient.configurations.v1,httpClientOptions) 
              .then((response: SPHttpClientResponse) => response.json())
              .then((response: any) => {
              if (response) {
                  console.log(response)
              let varitems =response.Result;
                  resolve(varitems)
              console.log(response.Row);     
              }
          });
          }); 

      });




No comments:

Post a Comment

Building Secure Azure AI Foundry Agents with Managed Identity

  The credential problem nobody wants to own Every team that connects an Azure AI Foundry agent to Microsoft Graph, SharePoint, Outlook, or...