Back

Magic Url flutter

  • 0
  • Flutter
  • Auth
  • Cloud
dyslexic_daddy
9 Jul, 2024, 12:50

I have read all the questions people have posted before me and this is what i have tired

TypeScript
onPressed: () async {
  final account = Account(client);
  try {
    await account.createMagicURLSession(
      email: _emailController.text,
      
    );
  } on AppwriteException catch(e) {
    print(e.message);
    // display error to the user
  }
}```
if you dont pass a url the email you receive will have https://cloud.appwrite.io/auth/magic-url? with userId and secret.
okey so this was the AndroidManifest.xml file 
<meta-data android:name="flutter_deeplinking_enabled" android:value="true" /> <intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="appwrite-callback-auth-[projectIDexample]:" /> </intent-filter> </activity> <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="appwrite-callback-[projectIDexample]" /> </intent-filter> </activity>
TypeScript
no luck did not even open the android app  
 okey now i have tired the custom domain option. i added the custom domain to appwrite console /settings/domains and as well added a platform with same custom domain or it doesnt work. and passed it as a url ,i was still not able to open app with link
TL;DR
Developers are experiencing issues with setting up a Magic URL in Flutter. The provided code and AndroidManifest.xml configurations seem to be causing problems with opening the Android app. Trying a custom domain and ensuring it is set up correctly in the Appwrite console may help resolve the issue.
dyslexic_daddy
9 Jul, 2024, 12:51
TypeScript
 onPressed: () async {
  final account = Account(client);
  try {
    await account.createMagicURLSession(
      email: _emailController.text,
      url:'appwrite-auth-callback-auth-[projectIDexample]://subdomain.Domain
.com/magic_url_session',
    );
  } on AppwriteException catch(e) {
    print(e.message);
    // display error to the user
  }
}

subdomain.Domain.com is the custom domain you added

dyslexic_daddy
9 Jul, 2024, 12:53

i even updated the AndroidManifest.xml <data android:scheme="appwrite-auth-callback-auth-[projectIDexample]:" android:host="subdomain.Domain .com" android:pathPrefix="/magic_url_session" />

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more