fitbitter icon indicating copy to clipboard operation
fitbitter copied to clipboard

Web View not closing after successful Authentication

Open subhoalmighty opened this issue 2 years ago • 13 comments

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 .

subhoalmighty avatar Jun 01 '22 19:06 subhoalmighty

I think you are not providing a correct redirect Uri.

gcappon avatar Jun 02 '22 14:06 gcappon

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 avatar Jun 03 '22 14:06 subhoalmighty

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 .

subhoalmighty avatar Jun 03 '22 16:06 subhoalmighty

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

gcappon avatar Jun 04 '22 06:06 gcappon

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

subhoalmighty avatar Jun 04 '22 15:06 subhoalmighty

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

gcappon avatar Jun 05 '22 09:06 gcappon

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

UvrajSB avatar Jul 08 '22 05:07 UvrajSB

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

gcappon avatar Jul 08 '22 07:07 gcappon

It is webview

UvrajSB avatar Jul 17 '22 06:07 UvrajSB

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.

gcappon avatar Jul 17 '22 17:07 gcappon

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

See this is the issue I am facing

UvrajSB avatar Jul 17 '22 20:07 UvrajSB

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.

gcappon avatar Jul 18 '22 07:07 gcappon

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');

ITcians avatar Jul 18 '22 12:07 ITcians

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

priyak-sdei avatar Jan 12 '23 10:01 priyak-sdei

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

gcappon avatar Jan 24 '24 08:01 gcappon