
So I'm working through the ideas tutorial and just to be sure I have copied and pasted all the code over and fixed all errors. Now I'm getting a 401 error I've checked that my endpoint and project ID are correct. Should I try using an API key instead?
Would love any help with this

Could you provide your code that is throwing a 401?

Certainly, here it is import { Client, Databases, Account } from "appwrite";
const client = new Client(); console.log('this is the client', client);
client.setEndpoint("https://cloud.appwrite.io/v1") .setProject("67d9e1fa00246f29e7c2");
export const account = new Account(client);
console.log('this is the account', account);
export const databases = new Databases(client); console.log('this is the database', databases);

This is what I'm getting in my browser console ''XHRGET https://cloud.appwrite.io/v1/account [HTTP/2 401 228ms] ''

Can you show me the call you're making to the account? Like maybe account.get()?

I've double checked all my creds are correct and I'm following this tutorial so I know my code is correct had to fix a few minor issues:

Good question, I don't think I can tbh. The code I just provided is doing that under the hood I think

So I've followed the tutorial to the letter and I'm still getting this. Do you think it could have something to do with the order in which I grab things. So there is a login page

But I'm not logged in yet

Maybe it's a silly suggestion

Can you give me the exact error from console, with the stack trace. I suspect it comes from the UserProvider init function.

Here is the title:

GET https://cloud.appwrite.io/v1/account [HTTP/2 401 228ms]

Yea, so this is expected. If the user isn't authenticated and you do account.get() it throws an error.

Here is the header stack trace

Oh shoot it's giving me this Your message could not be delivered. This is usually because you don't share a server with the recipient or the recipient is only accepting direct messages from friends. You can see the full list of reasons here: https://support.discord.com/hc/en-us/articles/360060145013

I see, is this a good sign

https
host
cloud.appwrite.io
filename
/v1/account
Address
172.67.36.127:443
Status
401```'''

Yea, if you see in the code
...
async function init() {
try {
const loggedIn = await account.get();
setUser(loggedIn);
} catch (err) {
setUser(null);
}
}
...
you are catching the error that is thown and setting the user to null

Have you impemented logging in? If so once you login do you still get this issue?
Recommended threads
- Invalid url param
AppwriteException: Invalid `url` param: URL host must be one of: localhost, cloud.appwrite.io, appwrite.io, *.appwrite.io, repox-pink.vercel.app at e.call (...
- Suddenly I cannot access my projects.
Today during add some data suddenly I got "Invalid Argument The current user is not authorized to perform the requested action." when I click on "Back to the c...
- Unhandled Runtime ErrorError: email@mail...
I'm encountering this issue when I try to login <#1072905050399191082> <#564161373148414012>
