Edit

Share via


Authenticate to Microsoft Dataverse with the Web API

You must use OAuth as described in Use OAuth with Dataverse.

The code you write to manage authentication when using the Web API depends on the type of deployment and where your code is.

Use the Az PowerShell module Azure application

You don't need to create your own app registration by using this method. You can use the Azure AD application to request an access token.

Use the Connect-AzAccount command to launch an interactive browser sign-in or initiate a device code flow. Connect-AzAccount also supports certificate-based auth, but this requires a registered application.

After you sign in, use the Az PowerShell module Get-AzAccessToken command to request an access token for your Dataverse organization URI resource.

Learn how to connect to Dataverse using PowerShell.

Authenticate by using JavaScript in web resources

When you use the Web API with JavaScript within HTML web resources, form scripts, or ribbon commands, you don't need to include any code for authentication. In each of these cases, the application already authenticates the user and manages authentication.

Use the Microsoft Authentication Library for JavaScript

If you're creating a single-page application (SPA) by using JavaScript, you can use the Microsoft Authentication Library for JavaScript (MSAL.js) as described in Use OAuth with Cross-Origin Resource Sharing to connect a Single Page Application.

See also

Use the Dataverse Web API
Web API types and operations
Perform operations using the Web API
Use OAuth with Dataverse
Use OAuth with Cross-Origin Resource Sharing to connect a Single Page Application