
Heyo,
I am getting: AppwriteException: Invalid redirect
in this code:
TypeScript
'use server'
import { createAdminClient } from '@/app/appwrite-session'
import { redirect } from 'next/navigation'
import { headers } from 'next/headers'
export async function loginWithOAuth2(provider: any) {
const { account } = await createAdminClient()
const origin = headers().get('origin')
console.log(origin)
const redirectUrl = await account.createOAuth2Token(
provider,
`${origin}/api/user/oauth`,
`${origin}/login?failure=true`
)
return redirect(redirectUrl)
}
Would someone know why? 🤔 Coming from this: https://appwrite.io/docs/tutorials/nextjs-ssr-auth/step-7#oauth-server-action
TL;DR
Issue: Developer is receiving an `AppwriteException: Invalid redirect` error on the `account.createOAuth2Token` function in their code.
Solution: Make sure the redirect URLs provided in the `account.createOAuth2Token` function match the allowed redirect URIs in your OAuth provider settings.Recommended threads
- deleteDocument shows The current user is...
my application is an ecomm app that list the products and i just want to add the delete functionality to delete the product the user has permission in appwrite...
- running the run() function with the maxT...
export default async function run( executor: IExecutor, queue: AsyncIterable<ITask>, maxThreads = 0 ) { maxThreads = Math.max(0, maxThreads); const A...
- File preview issue- "message": "Image tr...
Hi everyone 👋 I’m using Appwrite on the Free Plan. When I try to display images using getFilePreview() from the Storage API, I get this error: "message": "I...
