Back

[SOLVED] GET https://cloud.appwrite.io/v1/account 401 (Unauthorized)

  • 0
  • Web
Adrenaliin
1 Dec, 2023, 14:49

Hey guys,

Sorry to bother you. I'm wondering why does this keep showing up in the console? I do have error catching at each place I am using the account.get() and other than that everything works. Logging in, out & register.

I'd just like to be able to resolve those initial XHR error lines in the console that show up despite me catching the actual error with the message and all prior. The 401 is just an example. It happens for pretty much all errors. I always have this initial line and then the actual error if I don't catch it.

A sample of my code:

TypeScript
import { Client, Account } from 'appwrite';

const API_ENDPOINT = 'https://cloud.appwrite.io/v1';
const PROJECT_ID = import.meta.env.VITE_APPWRITE_PROJECT_ID;

const client = new Client();
client
    .setEndpoint(API_ENDPOINT)
    .setProject(PROJECT_ID);

export const account = new Account(client);

export default client;
TypeScript
const checkUserStatus = async () => {
    try {
        const accountDetails = await account.get();
        setUser(accountDetails);
    } catch (error) {
        console.log(error)
        setUser(null);
    }
    setLoading(false);
};

Best Regards!

TL;DR
The user is experiencing a console error message of 'GET https://cloud.appwrite.io/v1/account 401 (Unauthorized)' despite having error catching in their code. They are seeking help in resolving this issue.
Drake
1 Dec, 2023, 17:21

Not a bother at all! This is why this discord server exists!

This is just how the browser works. It'll log any unsuccessful API call (any http request that has a status code of 400 or more)

Drake
1 Dec, 2023, 17:22

And im assuming you mean the browser console log shows something like:

Adrenaliin
1 Dec, 2023, 18:12

Hey, Steven.

Yeah precisely that. I noticed a post online talking about it, but I couldn't find other sources to confirm.

Thanks for the clarification. Much appreciated. πŸ™‚

Have a good one!

Drake
1 Dec, 2023, 18:19

[SOLVED] GET https://cloud.appwrite.io/v1/account 401 (Unauthorized)

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