Closed cavedweller closed 1 year ago
You did not follow the Readme correctly.
Your callback URLs all start with https
. Thus, https
is your URL scheme.
If you are able to change this to something else, you should definetly do that since http
and https
could interfere with other apps on the device.
@ThexXTURBOXx Thank you for your response. So I have changed the callback scheme but the issue persists.
var encoded = Uri.encodeComponent('https://social-login');
final url = Uri.parse(
'https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=78bo09ary48lus&redirect_uri=$encoded&scope=w_member_social');
try {
final result =
await FlutterWebAuth2.authenticate(url: url.toString(), callbackUrlScheme: 'https'); //social-login
print('success');
print(result);
} on PlatformException catch (e) {
print('error');
print(e.message);
print(e.details);
}
<activity android:name="com.linusu.flutter_web_auth_2.CallbackActivity" android:exported="true">
<intent-filter android:label="flutter_web_auth_2">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme= "https"/>
<!--<data android:scheme="social-login" android:host="callback" />-->
</intent-filter>
</activity>
Please only authorize the following redirect URL for your app: https://social-login/callback
Also, again, it is very advisable not to use https
!
Finally, please also try the following fragment in AndroidManifest.xml
:
<activity android:name="com.linusu.flutter_web_auth_2.CallbackActivity" android:exported="true">
<intent-filter android:label="flutter_web_auth_2">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme= "https" android:host="social-login" android:pathPrefix="/callback"/>
</intent-filter>
</activity>
and if that one also does not work, try this one:
<activity android:name="com.linusu.flutter_web_auth_2.CallbackActivity" android:exported="true">
<intent-filter android:label="flutter_web_auth_2">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme= "https" android:host="social-login" android:pathPrefix="callback"/>
</intent-filter>
</activity>
@ThexXTURBOXx Thanks again but I am still facing the same issue
Unfortunately I have to use either the https or http path
<activity android:name="com.linusu.flutter_web_auth_2.CallbackActivity" android:exported="true">
<intent-filter android:label="flutter_web_auth_2">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<!--<data android:scheme= "https" android:host="social-login" android:pathPrefix="/callback"/>-->
<data android:scheme= "https" android:host="social-login" android:pathPrefix="callback"/>
</intent-filter>
</activity>
I did try both but they do not work
var encoded = Uri.encodeComponent('https://social-login/callback');
final url = Uri.parse(
'https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=78bo09ary48lus&redirect_uri=$encoded&scope=w_member_social');
final result =
await FlutterWebAuth2.authenticate(url: url.toString(), callbackUrlScheme: 'https'); //social-login
In that case, sadly, this seems to be one of these cases where the callback provider (LinkedIn) is at fault. There is nothing application/library developers can do about such cases until they fix their backend. You could try getting in contact with them to allow custom callback URL schemes
Hi, I am facing issue with the instagram login. Same issue.
<activity android:name="com.linusu.flutter_web_auth_2.CallbackActivity" android:exported="true">
<intent-filter android:label="flutter_web_auth_2">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme= "https" android:host="social-login" android:pathPrefix="/callback"/>
</intent-filter>
</activity>
Code file :
final authUrl =
'https://www.instagram.com/oauth/authorize?client_id=$_instagramClientId&redirect_uri=$encoded&scope=user_profile,user_media&response_type=code';
final result = await FlutterWebAuth2.authenticate(
url: authUrl,
callbackUrlScheme: 'https',
);
Facing same issue with Dropbox Oauth
@justsaagar hey, did you manage to implement it?
Issue
I am trying to authenticate a user with LinkedIn. I am able to get all the way to the authorize screen but when the user has successfully signed in the redirect URI tries to target a website instead of redirecting back into the app. The redirect URI is not a website so it just loads a DNS error on the web page.
How do I redirect back int the app?
Android Manifest
Dart code
Call back URL as per Linkedin
Device used
Samsung s10
Additionally
I am also trying to log into TikTok and I am facing the same issue where it tries redirecting to the URI instead of the back to the app
Any help would be greatly appreciated 😎