gcappon / fitbitter

A Flutter package to make your life easier when dealing with Fitbit APIs.
https://gcappon.github.io/fitbitter/
BSD 3-Clause "New" or "Revised" License
19 stars 21 forks source link

Web View not closing after successful Authentication #8

Closed subhoalmighty closed 7 months ago

subhoalmighty commented 2 years ago

I have successfully integrated Fitbitter and the login and subsequent permission page, the app is redirecting to the redirection url. I am also getting the Authorization Code through Uni Link stream listener.

But everything is happening in background while the web view stays at the top. It never closes and Fitbit.com permission page comes back again. Is there any way to close the WebView after successful authentication. I am on a 7th generation iPad unnamed .

gcappon commented 2 years ago

I think you are not providing a correct redirect Uri.

subhoalmighty commented 2 years ago

Actually, what I have found out after thorough inspection is that - the redirection is working fine but in return, it always showing user has cancelled the authentication process. As I was accessing other datas after authentication those processes were showing errors and it seemed like the redirection was not happening.

Screenshot 2022-06-03 at 7 36 41 PM

.

subhoalmighty commented 2 years ago

I have used uni_links: ^0.5.1 to check what links I am getting back. It returns with the correct values

Screenshot 2022-06-03 at 10 23 17 PM

.

gcappon commented 2 years ago

Ok, can you copy&paste the piece of code where you are calling Fitbitter.authorize?

subhoalmighty commented 2 years ago

String? userId = await FitbitConnector.authorize( context: context, clientID: Strings.fitbitClientID, clientSecret: Strings.fitbitClientSecret, redirectUri: Strings.fitbitRedirectUri, callbackUrlScheme: Strings.fitbitCallbackScheme);

gcappon commented 2 years ago

The only other "normal" bug can be that you used wrong fitbitRedirectUri and callBackUrlScheme. Could you please check this?

UvrajSB commented 2 years ago

@subhoalmighty I am facing the same issue, it would be great if you can share the solution if you got any.

gcappon commented 2 years ago

Is the browser that you are using (the one that pops up) WebView? Or is it Chrome/Safari?

UvrajSB commented 2 years ago

It is webview

gcappon commented 2 years ago

That's why you are experiencing the issue! For some reason webview does not close itself. I can assure you that the problem will disappear if you use Chrome.

UvrajSB commented 2 years ago

https://user-images.githubusercontent.com/73571511/179423528-b6410df3-f095-482e-9595-9c1cedb1aed2.mp4

See this is the issue I am facing

gcappon commented 2 years ago

Ok, the error seems suggesting that you are not setting the right URL SCHEME. Please check your manifest and how you are using the authorize() method.

ITcians commented 2 years ago

In my cause i have resolved that issue by removing :// from url scheme in dart code String? userId = await FitbitConnector.authorize( context: context, clientID: fitbitClientId, clientSecret: fitbitClientSecret, redirectUri: 'myapp://fitbit', callbackUrlScheme: 'myapp');

priyak-sdei commented 1 year ago

Any update on this. Facing the same issue. Android working fine. In iOS not redirecting to my app

gcappon commented 7 months ago

I am closing this since I just run the example app in iOS and Android and it works fine.