Yvens
Yvens
Explore posts from servers
KKinde
Created by Yvens on 9/14/2024 in #💻┃support
add-urls-to-kinde script
After creating a M2M application and setting the client_id and client_secret for my nextjs app. It seems that I can't get the addCallBackUrlToKinde function to work. I also added the scopes authorization related to application_redirect_uris to m2m application: Thank you for your help !
async function addCallbackUrlToKinde (token) {
try {
const response = await fetch(
`${process.env.KINDE_ISSUER_URL}/api/v1/applications/${process.env.KINDE_M2M_CLIENT_ID}/auth_redirect_urls`,
{
method: 'POST',
headers: {
Authorization: `Bearer ${token}`,
Accept: 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
urls: [`https://${process.env.VERCEL_URL}/api/auth/kinde_callback`]
})
}
)

if (!response.ok) {
console.log('response:', response)
throw new Error(
`Failed to add callback URL to Kinde: ${response.statusText}`
)
}

const responseData = await response.json()
console.log(
`SUCCESS: Callback URL added to Kinde: ${process.env.VERCEL_URL}/api/auth/kinde_callback`,
responseData
)
} catch (error) {
console.log('error:', error)
console.error('Failed to add callback URL to Kinde', error)
throw error
}
};
async function addCallbackUrlToKinde (token) {
try {
const response = await fetch(
`${process.env.KINDE_ISSUER_URL}/api/v1/applications/${process.env.KINDE_M2M_CLIENT_ID}/auth_redirect_urls`,
{
method: 'POST',
headers: {
Authorization: `Bearer ${token}`,
Accept: 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
urls: [`https://${process.env.VERCEL_URL}/api/auth/kinde_callback`]
})
}
)

if (!response.ok) {
console.log('response:', response)
throw new Error(
`Failed to add callback URL to Kinde: ${response.statusText}`
)
}

const responseData = await response.json()
console.log(
`SUCCESS: Callback URL added to Kinde: ${process.env.VERCEL_URL}/api/auth/kinde_callback`,
responseData
)
} catch (error) {
console.log('error:', error)
console.error('Failed to add callback URL to Kinde', error)
throw error
}
};
5 replies
CCConvex Community
Created by Yvens on 8/29/2024 in #support-community
[Convex ents] Getting Multiple docs using compound index in the most efficient way
Hello, How would you get a list of document using ents ?
photos: defineEnt({
clientId: v.id("organization_clients"),
organizationId: v.id("organizations"),
storageId: v.id("_storage"),
is_published_to_instagram: v.boolean(),
})
.field("instagram_id", v.optional(v.string()), { index: true })
.index("by_organization_instagram_id", ["organizationId", "instagram_id"])
.index("by_organization_client", ["organizationId", "clientId"])
photos: defineEnt({
clientId: v.id("organization_clients"),
organizationId: v.id("organizations"),
storageId: v.id("_storage"),
is_published_to_instagram: v.boolean(),
})
.field("instagram_id", v.optional(v.string()), { index: true })
.index("by_organization_instagram_id", ["organizationId", "instagram_id"])
.index("by_organization_client", ["organizationId", "clientId"])
Since this bellow, let you only read a single document with a compound index
const task = await ctx.table("users").get("nameAndRank", "Steve", 10);
const task = await ctx.table("users").get("nameAndRank", "Steve", 10);
1 replies
CCConvex Community
Created by Yvens on 6/12/2024 in #support-community
Mock Service Worker implementation
Hello guys, I'm giving a go at MSW, and I'm not sure about the implementation. The way I do it feel strange to me does anyone could give it a look and let me know if it makes sense ? Link of the gist: https://gist.github.com/Yvens16/bdd3cabd79bdc73791f7342f280a955d
4 replies
CCConvex Community
Created by Yvens on 5/1/2024 in #support-community
Paginate many to many edge (ents)
Hello, I don't get how to paginate a many to many query on convex-ents:
const result = username === ""
? await ctx.table("organizations").getX(organizationId).edge("users")
: await ctx
.table("users")
.search("search_username", (q) => q.search("username", username).eq("organizationId", organizationId))
.paginate(paginationOpts);
return result;
const result = username === ""
? await ctx.table("organizations").getX(organizationId).edge("users")
: await ctx
.table("users")
.search("search_username", (q) => q.search("username", username).eq("organizationId", organizationId))
.paginate(paginationOpts);
return result;
` My problem is on this line :
await ctx.table("organizations").getX(organizationId).edge("users")
await ctx.table("organizations").getX(organizationId).edge("users")
``
8 replies
CCConvex Community
Created by Yvens on 4/29/2024 in #support-community
Optional one to many relationship (convex-ents)
Hello, Is there a way to make an optional one to many relationship using egdes ? I would like to affect users to a group or no group.
users: defineEnt({})
.edge("user_group", { field: "groupId" }),
user_groups: defineEnt({})
.edges("users", { ref: "groupId" })
users: defineEnt({})
.edge("user_group", { field: "groupId" }),
user_groups: defineEnt({})
.edges("users", { ref: "groupId" })
`
9 replies
KKinde
Created by Yvens on 4/25/2024 in #💻┃support
Kinde Management api
Did I misunderstood something here ? I'm trying to create a user with the role "user", but Kinde does not seem to pick it up. It does not reflect on the dashboard. The key of the role I created is "user"
const apiClient = await createKindeManagementAPIClient();
const addedToOrzanisation = await apiClient.organizationsApi.addOrganizationUsers({
orgCode: organization.orgCode,
addOrganizationUsersRequest: { users: [{ id: createdUser.id, roles: ["user"] }] }
});
const apiClient = await createKindeManagementAPIClient();
const addedToOrzanisation = await apiClient.organizationsApi.addOrganizationUsers({
orgCode: organization.orgCode,
addOrganizationUsersRequest: { users: [{ id: createdUser.id, roles: ["user"] }] }
});
Thank you
9 replies
CCConvex Community
Created by Yvens on 4/24/2024 in #support-community
Convex-test/ents
Is there a way to use ctx.table in a test ?
await t.run(async (ctx) => {
// roles created
ctx.table("users").insert({ firstname, roles: [roleId1, roleId2] })
});
await t.run(async (ctx) => {
// roles created
ctx.table("users").insert({ firstname, roles: [roleId1, roleId2] })
});
Or should I insert data in the "users_to_roles" table created by ents ?
const t = convexTest(schema);
await t.run(async (ctx) => {
// roles created
// users created
ctx.db.insert("users_to_roles", { userId, roleId })
});
const t = convexTest(schema);
await t.run(async (ctx) => {
// roles created
// users created
ctx.db.insert("users_to_roles", { userId, roleId })
});
I don't get how to re-create the edge in my db setup. Thank you
42 replies
KKinde
Created by Yvens on 4/22/2024 in #💻┃support
What would be the most secure way to create invitation link for users to join an organizations ?
I'm using resend to send the invitation link (Nextjs app router SDK). The link should be created with the org_code. I would like to make it one-time use. Let me know if you have any other security concerns I should think about. I know that I may need to implement the thing or a part of it myself. I want to be sure that there isn't an other way already provided by Kinde. Thank you
5 replies
CCConvex Community
Created by Yvens on 4/5/2024 in #support-community
Problem testing convex function with convex-test.
No description
18 replies
KKinde
Created by Yvens on 2/20/2024 in #💻┃support
Testing protected pages in cypress (e2E)
Hello, Is there a way to bypass the authentication process to e2e test pages and flows that are protected ? I'm new to e2e testing and I see everywhere else that there are mechanism to mock the auth or authenticate the user programmatically. Maybe I'm missing something. I'm using The app router SDK.
17 replies
PD🧩 Plasmo Developers
Created by Yvens on 7/23/2023 in #👾extension
Using context between sidepanel tabs
Is it possible to use a context with a firebase hook to handle authentication between multiple sidepanel tabs ? Because I'd like to be able to navigate between multiple sidepanels for differents features in my extensions.
2 replies
PD🧩 Plasmo Developers
Created by Yvens on 7/13/2023 in #👟framework
Login with firebase using google auth
I'm trying to log in my users using the google login but I always have this error after following the tutorial about firebase & google auth: "OAuth2 request failed: Service responded with error: 'bad client id: client_id_from_gcp
2 replies