Back

I/flutter (24343): AppwriteException: general_argument_invalid, Invalid url

  • 0
  • Flutter
alex2341355
5 Sep, 2023, 08:46

but what is url. i have not eny url to past

TL;DR
Issue: AppwriteException: general_argument_invalid, Invalid url Solution: Make sure to use 3 backticks for multiline code. Additional tips: - To modify email templates, update to version 1.4 (Cloud is not yet on 1.4). - To change icon and text in received mail, refer to the relevant documentation. - To get userId and secret from a URL, set the redirect URL in `createMagicURLSession` and use `updateMagicURLSession` on the page the user hits after clicking the link. - Check the `GoRouter` configuration and implementation for any errors or missing routes.
alex2341355
5 Sep, 2023, 08:47

print(res.secret); - empty string

ideclon
5 Sep, 2023, 08:48

Anyway, updateMagicURLSession should be called on the page the user hits when clicking the link, not directly after calling createMagicURLSession - you don’t have the secret here yet

ideclon
5 Sep, 2023, 08:49

I’m not much into mobile dev, but I believe you should be able to create a “deeplink” which hits a specific page with your app?

alex2341355
5 Sep, 2023, 08:49

buy if user hit to link he get some page with your Magic url login flow is missing a propper riderect URL. Please check the Magic URL docs and send request for new session with a valid redirect URl

ideclon
5 Sep, 2023, 08:49

Not sure how query parameters would be handled with that

ideclon
5 Sep, 2023, 08:50

Because you haven’t set a redirect URL - you need to pass one in createMagicURLSession as the url parameter

alex2341355
5 Sep, 2023, 08:51

yes. but how i can to know what url it is must be? i have no my domain or some like that

alex2341355
5 Sep, 2023, 08:51

i use appwrite cloud

alex2341355
5 Sep, 2023, 08:53

i get this lisnk. and it give your Magic url login flow is missing a propper riderect URL. Please check the Magic URL docs and send request for new session with a valid redirect URl

ideclon
5 Sep, 2023, 08:54

My understanding here is that you’ll have to create a deeplink to a component in your app that can handle the completion of the login process

ideclon
5 Sep, 2023, 08:54

As I’ve said, I don’t really know mobile dev - you might want to wait for someone who does and might have a better solution here.

alex2341355
5 Sep, 2023, 08:58

thank you

Drake
5 Sep, 2023, 22:01

ideclon is correct. You must implement deep linking. There are resources online regarding deep linking. For example: https://docs.flutter.dev/ui/navigation/deep-linking

alex2341355
7 Sep, 2023, 08:43

`<intent-filter> <action android:name="android.intent.action.MAIN"/> <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> <intent-filter android:autoVerify="true" tools:targetApi="m"> <action android:name="android.intent.action.VIEW" />

TypeScript
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />

            <data
                android:scheme="https"
                android:host="cloud.appwrite.io"
                android:pathPrefix="/auth/magic-url" />
        </intent-filter>`
alex2341355
7 Sep, 2023, 08:44

`final GoRouter _router = GoRouter(routes: [ GoRoute( path: "/", builder: ((context, state) => const MainAuthScreen()), ), GoRoute( name: "/auth/magic-url", path: "/profile", builder: ((context, state) => const ProfileScreen()), ),

]);`

darShan
7 Sep, 2023, 08:59

can you show your complete GoRoute config and implementation?

alex2341355
7 Sep, 2023, 09:01

` MaterialApp.router( builder: (context, child) { return ScrollConfiguration( behavior: MyBehavior(), child: child!, ); }, debugShowCheckedModeBanner: false, title: 'Iskra', theme: MaterialThemeData().materialThemeData, routerConfig: _router, ), ); }, ); } }

final GoRouter _router = GoRouter(routes: [ GoRoute( path: "/", builder: ((context, state) => const MainAuthScreen()), ), GoRoute( name: "/auth/magic-url", path: "/profile", builder: ((context, state) => const ProfileScreen()), ), ]);

darShan
7 Sep, 2023, 09:10

You’ve set your path for handling magic link session on path: /profile. Try using /auth/magic-url as path.

alex2341355
7 Sep, 2023, 09:27

Thank you Sir!!!

darShan
7 Sep, 2023, 09:46

Great! Can this thread be marked [Solved] then?

alex2341355
7 Sep, 2023, 10:12

yes, sure. Do you know, how i can change icon and text in recived mail? and How i can get userId and secret form this url?

ideclon
7 Sep, 2023, 10:21

v1.4 allowes you to modify email templates, but Cloud is not on 1.4 yet.

Drake
7 Sep, 2023, 17:46

make sure to use 3 backticks for multiline code like:

TypeScript
`​``xml
<xml>
``​`
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