I am writing a Windows app that will retrieve weather station readings from Netatmo.
The app needs to authenticate with Netatmo API (authentication code grant), and I am trying to use MSAL's PublicClientApplicationBuilder
for this.
The client Id provided by Netatmo's app registration is a 24 character string, while MSAL seams to accept only string that can be parsed into a GUID. Therefore, the builder throws a MsalClientException with message: "Error: ClientId is not a GUID.".
var publicClientApp = PublicClientApplicationBuilder
.Create("8543a5684dbe6325b15bcc4b")
.WithAuthority("https://api.netatmo.com/oauth2")
.Build();
According to OAuth2 (RFC 6749) the client Id is not required to be a GUID.
So the question is, is their a work-around for this odd requirement in MSAL, or should I use a different authentication client? The app already uses MSAL to authenticate with outlook.office.com, therefore that was my first choice.
The Microsoft identity platform (aka Azure AD) exclusively uses GUIDs for its client IDs. Since MSAL is a library designed specifically for interacting with this, and officially does not support other identity providers, they've decided to enforce this restriction in the library itself. Here's a longstanding issue on their GitHub repo.
In the meantime, you would probably have to use a different library, or roll your own.