question

Vibha-4586 avatar image
1 Vote"
Vibha-4586 asked ·

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

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
· 4
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @Vibha-4586, Thanks for reaching out to us!, could you please let us know the exact documentation you have followed for this Hello World Sample ?


0 Votes 0 ·

Hello @Vibha-4586,Just checking back, could you please let us know if you need further help in this matter.


0 Votes 0 ·

Hello @Vibha-4586, Could you please let us know if you need further help in this matter.


0 Votes 0 ·

1 Answer

SatishBoddu-MSFT avatar image
2 Votes"
SatishBoddu-MSFT answered ·

Hello @Vibha-4586, 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



image.png (115.9 KiB)
image.png (71.5 KiB)
· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hello @Vibha-4586, Could you please let us know if you need further help in this matter. Please accept helpful responses as 'Answer' as they might be helpful to other as well.

0 Votes 0 ·