kmΟShα
any one can help me?
TL;DR
The developers are facing an issue with 'general_unauthorized_scope' in their code related to authentication. The problem seems to stem from unauthorized access.
Solution:
Make sure that proper scopes are set for the OAuthProvider in the code for successful authentication. kmΟShα
this is my code:
TypeScript
// lib/auth.ts
"use server";
import {
API_ENDPOINT,
API_KEY,
PROJECT_ID,
SESSION_COOKIE,
} from "@/config/appwrite";
import { Account, Client, OAuthProvider } from "node-appwrite";
import { cookies, headers } from "next/headers";
let appwriteClient = new Client()
.setEndpoint(API_ENDPOINT)
.setProject(PROJECT_ID)
.setKey(API_KEY);
let account = new Account(appwriteClient);
export async function getSession() {
const cookieStore = cookies();
const sessionId = cookieStore.get(SESSION_COOKIE)?.value;
if (!sessionId) {
return null;
}
try {
const session = await account.getSession(sessionId);
return session;
} catch (error) {
console.error("Failed to get session:", error);
return null;
}
}
export async function signIn(provider: "google") {
const origin = headers().get("origin") || "";
const success = `${origin}/api/auth/callback/${provider}`;
const failure = `${origin}/auth/error`;
const url = await account.createOAuth2Token(
OAuthProvider.Google,
success,
failure
);
return { url };
}
kmΟShα
@Steven sorry for ping.. but did you have any solve?
kmΟShα
i need help: general_unauthorized_scope
Recommended threads
- Appwrite Cloud is a trojan, says Malwar...
Since today, my Malwarebytes doesn't let me connect to appwrite cloud anymore. I try to connect from my own (WIP) website and the connections seem to all be fin...
- Application error: a client-side excepti...
I just deployed my first project to Vercel but im having some issues. The homepage loads up fine but going to login im hit with the title error... I initialize...
- domain verification failed
before 5 days i have added information but still verification is failed what will i do