ThexXTURBOXx / flutter_web_auth_2

Flutter plugin for authenticating a user with a web service
https://pub.dev/packages/flutter_web_auth_2
MIT License
51 stars 50 forks source link

Working with fixed redirects not in my app domain #53

Closed KartikAiyer closed 1 year ago

KartikAiyer commented 1 year ago

I apologize for creating an issue when what I'm really doing is trying to get some help.

I'm trying to connect to the Tesla Auth provider (which is unofficially documented here) and trying to use Flutter Web Auth 2 to perform the front channel flow and allow my user to authorize my app and obtain the access and refresh tokens. Unfortunately at this time, Tesla doesn't really cater to other third-party apps and basically most third-party apps out there masquerade as the Tesla App. The OAuth front channel workflow uses a fixed redirect callback URL of https://auth.tesla.com/void/callback which is not a real page on Tesla and the authorization code is delivered as a query parameter to that URL. My question is, would I be able to intercept this redirect using Flutter Web Auth 2 (or in general) and obtain the URL? As of now I'm not sure how to go about doing this. I'm hoping to use this on desktop, mobile and web and was wondering if there are some platforms where this will work at least.

Again I apologize for creating an issue given that this is not a real bug. I'm new to web programming and OAuth so please forgive my ignorance.

ThexXTURBOXx commented 1 year ago

Hi, there is no easy way to tell. The easiest way is to just try it out. For the URL thing: That's the entire thing that this package does: When authentication is successful, it gives you the callback URL. However, some websites have weird redirects which cannot be detected by this package. So, as long as Tesla's website is not too weird, it should work out :)