JustiPhi
JustiPhi
CC#
Created by JustiPhi on 8/4/2023 in #help
❔ MAUI Community Toolkit Speech Recognition issue
on windows 10 I am getting a network failure with the following code:
private async Task Listen()
{
var isGranted = await SpeechToText.Default.RequestPermissions(tokenSource.Token);
if (!isGranted)
{
await Toast.Make("Permission not granted").Show(tokenSource.Token);
return;
}
var recognitionResult = await SpeechToText.Default.ListenAsync(
CultureInfo.GetCultureInfo("en-au"),
new Progress<string>(partialText =>
{
RecognitionText += partialText + " ";
}), tokenSource.Token);
if (recognitionResult.IsSuccessful)
{
RecognitionText = recognitionResult.Text;

await TextToSpeech.Default.SpeakAsync(recognitionResult.Text);
}
else
{
await Toast.Make(recognitionResult.Exception?.Message ?? "Unable to recognize speech").Show(tokenSource.Token);
}
}
private async Task Listen()
{
var isGranted = await SpeechToText.Default.RequestPermissions(tokenSource.Token);
if (!isGranted)
{
await Toast.Make("Permission not granted").Show(tokenSource.Token);
return;
}
var recognitionResult = await SpeechToText.Default.ListenAsync(
CultureInfo.GetCultureInfo("en-au"),
new Progress<string>(partialText =>
{
RecognitionText += partialText + " ";
}), tokenSource.Token);
if (recognitionResult.IsSuccessful)
{
RecognitionText = recognitionResult.Text;

await TextToSpeech.Default.SpeakAsync(recognitionResult.Text);
}
else
{
await Toast.Make(recognitionResult.Exception?.Message ?? "Unable to recognize speech").Show(tokenSource.Token);
}
}
the code appears to be working fine on windows 11 and android
8 replies
CC#
Created by JustiPhi on 5/4/2023 in #help
❔ Azure DevOps API Authentication issue (Managed Identity)
I am currently trying to add authentication to Azure managed Identity using Azure.Identity and Azure.Core in the following code:
var azureCredential = new DefaultAzureCredential();
var context = new TokenRequestContext(new string[] { $"{DevOpsURL}/.default" });
var token = await azureCredential.GetTokenAsync(context);

return token.Token;
var azureCredential = new DefaultAzureCredential();
var context = new TokenRequestContext(new string[] { $"{DevOpsURL}/.default" });
var token = await azureCredential.GetTokenAsync(context);

return token.Token;
I successfully get the token but when I try to use it in a bearer token auth header to get projects from
$"{DevOpsURL}/_apis/projects?api-version=7.0";
$"{DevOpsURL}/_apis/projects?api-version=7.0";
I get the following error
TF400813: The user 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' is not authorized to access this resource."
TF400813: The user 'aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa' is not authorized to access this resource."
is there anything im missing as using a PAT (basic token auth header) from my own account works with the same fetch but using the managed identity one seems to not associate with an account the app is running through azure app services and it is a system managed identity Thanks
57 replies
CC#
Created by JustiPhi on 4/26/2023 in #help
Using Azure Managed Identities API
I am trying to get an api token using azure managed identity through an application hosted by azure app services, when trying to get the token through a get request using System.Environment.GetEnvironmentVariable("MSI_ENDPOINT"); as my endpoint I get a 403 status on the response, any ideas what I could be missing?
28 replies
CC#
Created by JustiPhi on 9/18/2022 in #help
Issue with JSON Serialisation
When converting from object to json i need my list of object to be as follows "group": [{ "item": {}, "item": {} }] Instead I am getting "group": [{ "item": [ {}, {} ] }] How would I create my object to serialise it in the correct way? Thanks in advance
22 replies