Back

Auth Error on Safari

  • 0
  • Self Hosted
  • Web
coffeebean
3 Jan, 2024, 02:15

Authentication works great on Chrome but for whatever reason when trying to authenticate using Safari, I receive this error.

AppwriteException: User (role: guests) missing scope (account)

It errors on this piece of code where I am checking to see if the user has a session.

TypeScript
 useEffect(() => {
        setUserLoading(true);
        setIsLoading(true);
        account
            .getSession("current")
            .then((response) => {
                setUserLoading(false);
                setIsLoading(false);
                if (response) {
                    if (pathName === HOME_ROUTE) {
                        router.push(ACCOUNT_ROUTE);
                    }
                }
            })
            .catch((error) => {
                console.error(error);
                setUserLoading(false);
                setIsLoading(false);
                router.push(HOME_ROUTE);
            });
    }, [user]);```

I understand it is suppose to give that error when there is no session.. and I know the user is being authenticated because they are being created in the control panel.

Here is how I am authenticating, just in case this helps

```js
  const onClick = async () => {
        account.createOAuth2Session(
            "discord",
            "http://localhost:3000",
            "http://localhost:3000"
        );
    };

This is on localhost, I have not tried deploying it yet.

TL;DR
The user is experiencing an authentication error on Safari when using custom domains. The error message states "AppwriteException: User (role: guests) missing scope (account)." The issue arises when checking if the user has a session. The user believes that deploying the project, rather than using localhost, might resolve the issue. They provide code snippets showing how they are authenticating the user.
coffeebean
3 Jan, 2024, 02:19

Reading this https://appwrite.io/docs/advanced/platform/custom-domains, I'm assuming the issue will resolve once I deploy and not use localhost?

Drake
3 Jan, 2024, 04:35

Yes, if you configure the custom domain as suggested

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