TemplateStudio icon indicating copy to clipboard operation
TemplateStudio copied to clipboard

Add AppclientID and scopes login wts

Open Javier118 opened this issue 5 years ago • 11 comments

how to add appClientID and Scopes Login WTS for OneDrive Service

Javier118 avatar Apr 18 '20 16:04 Javier118

You can use the Forced Login or Optional Login template to authenticate the user and get data from the Microsoft Graph. The generated code contains instructions on how to register the application. You can find more info on https://github.com/microsoft/WindowsTemplateStudio/blob/dev/docs/UWP/services/identity.md

sibille avatar Apr 20 '20 06:04 sibille

Then the ClientID of the App and scopes where it would be implemented. I downloaded the Azure sample

Javier118 avatar Apr 20 '20 11:04 Javier118

api has used microsoft. Identy.client, Microsoft. Graph.service and OnedriveService

Javier118 avatar Apr 20 '20 11:04 Javier118

've been selling the example I downloaded into Azure by looking at the example I've seen that in the call for authentication comes the scopes code. the doubt is that part of the OnLOggedIn code I have to introduce scopes , also example I have seen this code that goes intinialize();

PublicClientApp = PublicClientApplicationBuilder.Create(ClientId) .WithAuthority("https://login.microsoftonline.com/common") .WithLogging((level, message, containsPii) => { Debug.WriteLine($"MSAL: {level} {message} "); }, LogLevel.Warning, enablePiiLogging: false, enableDefaultPlatformLogging: true) .WithUseCorporateNetwork(true) .WithRedirectUri(Constant.PublicClientRedirectUri) .Build();

Javier118 avatar Apr 20 '20 15:04 Javier118

Not sure what's the sample your looking at, but you can use WTS Templates for "Forced Login" or "Optional Login" to set this up. The scope is passed as a parameter for getting the authenticatication token on user login.

_authenticationResult = await _client.AcquireTokenInteractive(_graphScopes)
                                                     .WithAccount(accounts.FirstOrDefault())
                                                     .ExecuteAsync();

sibille avatar Apr 23 '20 16:04 sibille

Suspect this is an opportunity for providing clearer documentation in this area. Or pointing to existing docs if they exist.

mrlacey avatar Aug 12 '20 10:08 mrlacey

🦙 @mrlacey I know they're still in preview, but we have the Graph Controls in the WCT as well. Is this a common scenario/ask you see for Graph integration in WTS?

Maybe we should figure out a plan for integration in the future?

michael-hawker avatar Aug 26 '20 23:08 michael-hawker

🦙 @mrlacey I know they're still in preview, but we have the Graph Controls in the WCT as well. Is this a common scenario/ask you see for Graph integration in WTS?

Maybe we should figure out a plan for integration in the future?

I've created #3812 to track this and keep discussions separate.

mrlacey avatar Aug 27 '20 12:08 mrlacey

@Javier118, I went through the docs and added a few more links. Identity is a complex topic though, what exactly is your scenario and where are you having problems? A repro project would also help to understand the issue.

sibille avatar Sep 18 '20 14:09 sibille

search for OneDrive's ejemplo for MSA account.

Javier118 avatar Sep 23 '20 18:09 Javier118

@Javier118, we need more information to look into this. Could you share a link to the sample? What's the exact problem you are facing? Happy to answer questions in spanish or other languages too.

Necesitamos más información para mirar esta issue. Puede darnos un enlace al ejemplo que menciona? Cuál es el problema que está encontrando? Estamos encantados de contestar preguntas en español u otros idiomas.

sibille avatar Sep 24 '20 09:09 sibille