
What's your code?

account.createOAuth2Session('google', 'https://localhost:5173/creator', 'https://localhost:5173')
I have used react router for providing the routes.

You can't use localhost as a domain for Google Auth

Google requires having a domain running

Also localhost is not https

Just http

The error you're getting is due to that

But I had used it earlier in one of my projects.

Not sure, but last time I checked it required a domain. But in your case the problem seems to be you're using https instead of http in the URL

Yes I will try that

I think the problem could be https
+ localhost

can you change that https to http?

Yup! It's working now. Thanks!

One more question, is there any way I can add roles, like I have two buttons one for logging in the creator and the other for logging in the editor. What I want to do is whenever either of the buttons is clicked the required role is added to the user.

Maybe you can use user labels: https://appwrite.io/docs/products/auth/labels

Is there any way I can do this in React? Or should I create a separate node file?

Maybe create the account using an Appwrite function that can also assign the label

Ok I'll try that

I am trying to create an appwrite function for adding labels to a user. Here is the code: `import { Client, Users } from "node-appwrite";
// This is your Appwrite function // It's executed each time we get a request export default async ({ req, res, log, error }) => { // Why not try the Appwrite SDK? // const client = new Client() .setEndpoint('https://cloud.appwrite.io/v1') .setProject(process.env.APPWRITE_FUNCTION_PROJECT_ID) .setKey(process.env.APPWRITE_API_KEY);
const users = new Users(client);
const promise = users.updateLabels(
req.user_id,
[ req.role ]
);
promise.then(function (response) { console.log(response); // Success return res.send(response); // Success }, function (error) { console.log(error); // Failure return res.send(error); // Failure });` In the appwrite I am getting this error (as shown in the image), what am I doing wrong? Need help.

what SDK version is listed in your package.json?

you're letting hte user add whatever label they want? that doesn't seem safe 🧐

What I am trying to do is achieve role based routing, I want the users to either sign in as creator or editor. For this I have two separate buttons, when the user clicks on it the user will be authenticated and the required role will be added, I was thinking of passing the user id and the role through request headers. Is there any better way to do it?

At the very least you should validate the input.
Although, honestly, I would do this on the front end the same way you'd have a light theme vs dark theme and letting the user choose between the two

Ok got it

I was following the steps on contributing.md to setup the development environment, after running docker compose build
I am getting this error. What I can understand is it is asking for node version 10 something, but when I tried to install this version using nvm it says "npm@10.1.0" is not a valid version or known alias
.
Recommended threads
- Auth Error
`const user = await createSessionClient(session).account.get(); ` node-appwrite package can work but react-native-appwrite package cannot work. The only diffe...
- Is this 24h overview?
When checking cloud.appwrite.io/console/project/overview/platforms There is Database, Storage, Auth and Function overview (Image is pinned). Is this 24h usage ...
- Auth Error
`const user = await createSessionClient(session).account.get(); ` node-appwrite package can work but react-native-appwrite package cannot work. The only diffe...
