Skip to content

Unexpected behaviour when laravel 12 and passport 12 with mongodb 5.4 #3371

Open
@faisaltkr

Description

@faisaltkr
  • Laravel-mongodb Version: 5.3 and above
  • PHP Version: 8.2 and above
  • Database Driver & Version: mongodb

Description: When we installing passport with mongodb, the _id is storing as string

Steps to reproduce

  1. Install laravel 12 and mongodb 5.3 and above and install laravel-passport
  2. After configuring the passport try to add same requests at a time to generate access_token
  3. follow mongodb laravel-passport setup doc : https://www.mongodb.com/docs/drivers/php/laravel-mongodb/current/user-authentication/#laravel-passport

Expected behaviour

{
    "_id" : ObjectId("67af1b54cab5260f0e02c45e"),
    "id" : "2d5975c24790106151a359b50cd65e8df24d667c45198c9543d8a730d4f3b2a3acbd5e6ac9b9de3b",
    "user_id" : "5fd345d8881f551ed73033a2",
    "client_id" : "678f73cda02347dc38027792",
    "scopes" : "[]",
    "revoked" : false,
    "created_at" : ISODate("2025-02-14T10:30:44.163+0000"),
    "updated_at" : ISODate("2025-02-14T10:30:44.198+0000"),
    "expires_at" : ISODate("2025-08-14T10:30:44.163+0000"),
    "name" : "example-token"
}

Actual behaviour

{
    "_id" : "2d5975c24790106151a359b50cd65e8df24d667c45198c9543d8a730d4f3b2a3acbd5e6ac9b9de3b",
    "user_id" : "5fd345d8881f551ed73033a2",
    "client_id" : "678f73cda02347dc38027792",
    "scopes" : "[]",
    "revoked" : false,
    "created_at" : ISODate("2025-02-14T10:30:44.163+0000"),
    "updated_at" : ISODate("2025-02-14T10:30:44.198+0000"),
    "expires_at" : ISODate("2025-08-14T10:30:44.163+0000"),
    "name" : "example-token"
}

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions