Skip to content
Back

Google Auth (appwrite) on Svelte Android app (with npm capacitor)

  • 2
  • Android
  • Accounts
  • Web
NewChallengers.net
28 Aug, 2023, 15:33

I could link my repo

TL;DR
The user is having trouble setting cookies with Google Auth on a Svelte Android app using npm capacitor. They are wondering if it is possible to extract cookies in the web (PWA) and then redirect to the mobile app with these variables to set the cookie in iOS/Android. It is suggested to rely on the Appwrite page that redirects to the app rather than passing a success URL. However, with capacitor, the cookie may not be automatically set, so manual extraction may be necessary. The user is not familiar with capacitor and asks if they can send their freelancer to help. No solution is provided in the thread.
NewChallengers.net
28 Aug, 2023, 15:33

It's the last part, the rest of my app is working well

D5
28 Aug, 2023, 15:34

Your problem seems like you're using capacitor, and appwrite like a js/web app, so it will not go back to the app since the SDK is not built for that because you have a PWA

Drake
28 Aug, 2023, 15:37

Sorry I am not

Drake
28 Aug, 2023, 15:41

So typically, for mobile apps, you wouldn't pass a success url. The user will end up on an Appwrite page that redirects to: appwrite-callback-[PROJECT_ID]://[...] which is a url scheme that the app is configured to pick up so the user is redirected into the app. Then, the sdk automatically extracts the cookie from the url and stores it for future use.

On web, the cookie is automatically set when the user is redirected back to the url you put.

Since you're using capacitor, I'm not sure if the cookie will be automatically set. If not, you'd have to manually extract the cookie after redirecting back to your app on a specific path (/auth/oauth2/success)

NewChallengers.net
28 Aug, 2023, 15:43

Ok thanks it's a bit over my head, mind if I send my freelancer here? I'm working with someone to finish it

Drake
28 Aug, 2023, 15:45

Go for it

NewChallengers.net
29 Aug, 2023, 19:19

he said he's getting this error

NewChallengers.net
29 Aug, 2023, 19:19
NewChallengers.net
29 Aug, 2023, 19:20

is there a different approach to take?

Drake
29 Aug, 2023, 22:09

Looks like the question was answered

xue
27 Dec, 2023, 00:49

capacitor is extracting cookie in only web (pwa) but if i redirect to mobile app it does not set cookies. is it logical way to extract cookies in pwa to set variables by using success url and then redirect to mobile app with these variables to set cookie in ios/android? in this manner, i am only using web-sdk not apple sdk. @Drake @D5

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