[Enhancement] Allow injecting the Parent Activity/Window in the Client Builder
See original GitHub issueDescription
The UI Parent (Window on UWP/Activity on Android) should be injected at the Client Application Builder level and not be required at the AcquireTokenInteractiveParameterBuilder level.
Current 3.0 API
var pca = PublicClientApplicationBuilder.Create(options.ClientId)
.WithB2CAuthority(authority)
.Build();
var result = await pca.AcquireTokenInteractive(Scopes)
.WithParentActivityOrWindow(Parent)
.ExecuteAsync();
Expected 3.0 API
var pca = PublicClientApplicationBuilder.Create(options.ClientId)
.WithB2CAuthority(authority)
.WithParentActivityOrWindow(Parent)
.Build();
var result = await pca.AcquireTokenInteractive(Scopes)
.ExecuteAsync();
Issue Analytics
- State:
- Created 4 years ago
- Comments:27 (15 by maintainers)
Top Results From Across the Web
Injecting parent component with base class type in angular
I'm trying to inject my parent component into a child component (tight cupling, I know). The problem is I have an inheritance chain...
Read more >Dependency injection with Hilt
Doing manual dependency injection requires you to construct every class and its dependencies by hand, and to use containers to reuse and manage...
Read more >Provide / Inject
Any component in the descendant tree, regardless of how deep it is, can inject dependencies provided by components up in its parent chain....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m in favor of the
WithParentActivityOrWindow
method going away. My auth code is in the view-model. Regardless of possible trickery for obtaining the window reference there, I’m opposed to view objects even passing through that layer.I would say this perhaps relates to #1104 since both these issues are around the ParentActivityOrWindow. The more I think about it, the more I’m thinking that perhaps we’re looking at the entirely wrong places. Perhaps this could all be simplified with a platform specific activity ONLY on those platforms where there is such a need.
Alternatively you could do what I do personally and take a dependency on Plugin.CurrentActivity. The benefit here, is that you’re not introducing a new API, and using a dependency most Xamarin.Android developers are already used to using.