Back

Email verification link that opens RN Expo app instead of webpage?

  • 0
  • React Native
  • Cloud
  • Auth
Walter
12 Sep, 2024, 03:17

I'm developing a React Native Expo app and I'm trying to verify new user emails and am able to get the link sent but it opens a webpage instead of directing the user back to the app where the rest of the verificatio process is finished. I've read through numerous threads on the Appwrite forum as well as here in Discord and checked the documentation.

But, I haven't found a clear solution for this. Can anyone provide more info or a workaround on Appwrite email verification for this use case? Thank you in advance.

Here is my code:

TypeScript
import { Client, Account, ID } from "react-native-appwrite";

export const appwriteConfig = {
    endpoint: 'https://cloud.appwrite.io/v1',
    projectId: '66d7be2e0028d583a81a',
    platform: 'com.appwrite.database',
}

let client = new Client();

client
    .setEndpoint(appwriteConfig.endpoint)
    .setProject(appwriteConfig.projectId)
    .setPlatform(appwriteConfig.platform);

export let account = new Account(client);

export const verificationUrl = "http://localhost:8081"; //<==== works as intended, but opens webpage
                                                //this is the address for Expo development server==========> exp://nxov2pc-waltert3-8081.exp.direct
 

const deleteSession = async () => {
    try {
        const activeSessions = await account.listSessions();
        if (activeSessions.total>0) {
            await account.deleteSessions();
        }
    } catch (error) {
        console.log(error)
    }

}

export async function loginUser(email, password) {
    try {
        await deleteSession();
        const session = await account.createEmailPasswordSession(email, password);
        console.log(session)
        await account.createVerification(verificationUrl)
        return session;
    } catch (error) {
        console.log(error)
    }
}

export async function registerUser(email, password) {
   await account.create(ID.unique(), email, password);
   // await loginUser(email, password); auto login after signup
}
TL;DR
Developing a React Native Expo app for email verification, but link opens webpage instead of app. Deep linking needed for React Native, not specific to Appwrite. Solution involves implementing deep linking to direct user back to the app for completion.
Walter
16 Sep, 2024, 22:52

Hello all, could I get some support regarding this?

Steven
19 Sep, 2024, 00:34

you're going to have to look into deep linking. that's a RN thing and nothing really specific to Appwrite

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