Hi, I am brainstorming about the best way to handle 2 types of api keys using Laravel Sanctum. One type of api key would be bound to a tenant, and the other type of api key would be bound to an individual user. Would this require me to have two Authenticatable models?
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
}
class ApiKey extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable;
}
@dukesteen sorry for being late. When you create a token, you can set expires_at. So if you set it, the token has an expiration. If you don't, then it doens't expire until you revoke it.
Below is the source code of Sanctum.
@pkboom From what I know there isn't an expires_at property on the default personal access token model? Would I need to override the createToken function on the user model class that implements HasApiTokens?