LinkedIn OAuth Bug

Hey there, I'm trying to add LinkedIn oauth to my app, I've done in better-auth but I wanna switch to convex cuz of scheduled functions but I can't login via LinkedIn OAuth, plus I'm trying to add scopes and I don't see any way to add the scopes array.
10 Replies
Convex Bot
Convex Bot2mo ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
jamwt
jamwt2mo ago
do you want to just use better-auth with convex? why would scheduled functions mean you need to change auth libraries? I don't quite get the complexity yet
Draco
Draco2mo ago
Oh I think this isn't documented anywhere officially but did you know you can use better auth with convex now? You dont necessarily need to move to convex auth to use convex The plugin is mostly stable for now, but keep checking #better-auth for updates
Zia Ur Rehman Khan
Zia Ur Rehman KhanOP2mo ago
I mean if I could use convex only that would be great Basically, I am developing an app where I use LinkedIn API so I am using the LinkedIn or to grab the user token but I don’t get the access to add scope to that token in convex and that’s the problem so is there anyway I can do it and maybe I can avoid using better-auth? Plus, I can’t even set up the LinkedIn OAutg compared Google OAuth example in the docs And I am using the scheduled functions to schedule LinkedIn post, if I can use the convex scheduled functions… that way I can get the real time data on my app with invalidation and other stuff I’ve :) Hope it makes sense
Draco
Draco2mo ago
Ok so as far as I know, convex auth is not advanced enough to support re-authorization for more scopes, but you could try Clerk or Auth0 if you dont really like better auth? Also if you're using convex auth, it's still technically another thing that you have to set up over convex, and it's not built into convex itself The better auth convex plugin is also made the same way as the convex auth one, and supports the same transactional capabilities in most places Clerk is by far going to be your best option though if you're going for ease in implementation, as they handle most of the stuff for you If you're using this app for only yourself, you techincally don't even have to take it out of dev mode For medium to large sized apps, moving to production would be a huge pain, but it would overall still be pretty good in the fact that it saves you alot of the implementation headache Although if you do wanna try it.... There is a way that isn't officially supported But you could use the Auth.js linkedin provider as a provider in convex
import LinkedIn from "@auth/core/providers/linkedin";
import { convexAuth } from "@convex-dev/auth/server";

export const { auth, signIn, signOut, store, isAuthenticated } = convexAuth({
providers: [
LinkedIn({
clientId: process.env.AUTH_LINKEDIN_ID,
clientSecret: process.env.AUTH_LINKEDIN_SECRET,
// Add your custom scopes here
scope: "r_liteprofile r_emailaddress w_member_social",
}),
],
});
import LinkedIn from "@auth/core/providers/linkedin";
import { convexAuth } from "@convex-dev/auth/server";

export const { auth, signIn, signOut, store, isAuthenticated } = convexAuth({
providers: [
LinkedIn({
clientId: process.env.AUTH_LINKEDIN_ID,
clientSecret: process.env.AUTH_LINKEDIN_SECRET,
// Add your custom scopes here
scope: "r_liteprofile r_emailaddress w_member_social",
}),
],
});
Something like this
Draco
Draco2mo ago
Convex with Auth.js (NextAuth)
Learn how to use Auth.js with your Next.js server and Convex backend to build a full-featured authentication system.
Draco
Draco2mo ago
You would wanna follow this tutorial for that But with the amount of setup required, you'd be in the same position as better auth
Zia Ur Rehman Khan
Zia Ur Rehman KhanOP2mo ago
Right, let me check with better auth… Thanks for the help, would you mind if I ask any questions as I implement? 😅 Could you please share the better auth plugin link?
Draco
Draco2mo ago
No worries, I'd be happy to help So would alot of people in #better-auth
Draco
Draco2mo ago
Convex + Better Auth
Typesafe, secure auth for Convex apps with Better Auth

Did you find this page helpful?