CosmicPredator
CosmicPredator

Reputation: 109

I Want to open a browser within an UWP app (for oAuth2 grant)

I'm developing an app which requires oAuth2.0 code authorization. So, I want to open a browser and get the Access Token by logging into their website. But I want to do that within my app, without opening any external browser. Can Anyone Help me ??

The Documentation for the oAuth is Found Here.

Upvotes: 2

Views: 708

Answers (2)

Nico Zhu
Nico Zhu

Reputation: 32775

I Want to open a browser within an UWP app (for oAuth2 grant)

UWP platform provide WebAuthenticationBroker class to get the Access Token by logging into their website within internal webview. And here is the detail steps how to use WebAuthenticationBroker. For more info please refer to official WebAuthenticationBroker code sample.

Upvotes: 2

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 117086

I understand what it is that you want to do. However what you are requesting would be a security risk for the user.

There is a reason why you cant / shouldnt do this.

  • By using the default web browser on the users machine. The user can be sure that this was their browser of choice and not an internal browser in your system which they have no control over.
  • second by opening it in a browser window the user can see the URL bar and verify that the authorization server is what they expect it to be

Oauth window opening for Google oauth you can see that the server it is going to is in fact googles authorization server.

enter image description here

What if this was possible.

If it was possible to request authorization from with in your app and you It would be very easy for you to set up a login screen to look exactly like the login for this authorization server. The user would then have no way of knowing that this was a fake login screen they were typing their credentials into.

All that being said I am not familiar with AniList API but I would hope that they do not allow you to do this. Open consent screen in the users browser and let them know that you are concerned with their security.

Upvotes: 1

Related Questions