I am working on an app and working on the validation side of things and noticed the refresh token action works perfectly until the auth collection ("users" in this case) has a relationship field. I have 2 different relationship fields, one called 'purchases' and the other called 'subscriptionPlan'. They both reference the same collection and aside from the refresh token, work as expected. Here is the user collection.
export const Users: CollectionConfig = {
slug: "users",
auth: {
maxLoginAttempts: 10,
verify: true
},
fields: [
// Typical user data like name, avatar, and bio with other things like joinDate, renewalDate
{
name: "stripeCustomerId",
type: "text",
label: "Customer ID",
maxLength: 64,
admin: {
readOnly: true,
position: "sidebar"
},
access: {
}
},
{
name: "stripeSubscriptionId",
type: "text",
label: "Stripe Subscription ID",
maxLength: 64,
admin: {
readOnly: true
},
},
{
name: "subscriptionPlan",
type: "relationship",
relationTo: "products",
label: "Subscription Plan"
},
// Subscription status as a select field was here
{
name: "purchases",
type: "relationship",
relationTo: "products",
hasMany: true
}
],
hooks: {}
}
My products are a plugin I created and these fields listed are appended when Payload initializes but in essence it is a product collection that interacts with the Stripe API. Feel free to request any more details as I would post more here but I hit my character limit for this post.