what should be the redirect URI set for this hello world program - getting error after authenticating to AAD

Vibha 1 Reputation point
2020-07-23T22:53:03.2+00:00

Code snippet:
using System;
using Azure.DigitalTwins.Core;
using Azure.Identity;
using System.Threading.Tasks;
using System.IO;
using System.Collections.Generic;
using Azure;
//using Azure.DigitalTwins.Core.Models;
using Azure.DigitalTwins.Core.Serialization;
using System.Text.Json;

namespace ADT
{
class Program
{
static async Task Main(string[] args)
{
Console.WriteLine("Hello World!");
string clientId = "xxxxxxxxxxxx";
string tenantId = "xxxxxxxxxxxx";
string adtInstanceUrl = "https://xxxxxxx.digitaltwins.azure.net";
var credentials = new InteractiveBrowserCredential(tenantId, clientId);
DigitalTwinsClient client = new DigitalTwinsClient(new Uri(adtInstanceUrl), credentials);
Console.WriteLine($"Service client created – ready to go");

       Console.WriteLine();
        Console.WriteLine($"Upload a model");
        var typeList = new List<string>();
        string dtdl = File.ReadAllText("sample.json");
        typeList.Add(dtdl);
        // Upload the model to the service
        try
        {
        await client.CreateModelsAsync(typeList);
        Console.WriteLine($"Model Uploaded Successfully");
        }
        catch (RequestFailedException rfe)
        {Console.WriteLine($"{rfe.Message}");} 
    }
}

}

Azure Digital Twins
Azure Digital Twins
An Azure platform that is used to create digital representations of real-world things, places, business processes, and people.
219 questions
{count} votes

1 answer

Sort by: Most helpful
  1. QuantumCache 20,031 Reputation points
    2020-07-23T23:57:41.557+00:00

    Hello @Vibha , Please as part of Prerequisite, create an AAD app and provide the Redirect URI as per the instructions.

    Below image shows how i registered my app in AAD.

    13571-image.png

    13544-image.png

    1 person found this answer helpful.