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
- is `account.get()` safe to be used in th...
I want to user's `id` for authentication. However, a while ago I was told in this server not to use `account.get()` and instead add user preferences for that us...
- Usage of the new Client() and dealing wi...
Hey guys, just a quick one - we had some web traffic the other day and it ended up bombing out - To put in perspective of how the app works, we have a Nuxt Ap...
- [Beginner] CLI --queries Syntax Error & ...
Hi everyone! I am a beginner with Appwrite and trying to use the CLI, but I'm stuck with a syntax error. Any guidance would be greatly appreciated! 🙏 **Enviro...