designmynight / laravel-mongodb-passport

A package to get Laravel Passport working with MongoDB
MIT License
67 stars 75 forks source link

I'm getting invalid createToken error #1

Closed amittrigma closed 6 years ago

amittrigma commented 6 years ago

Error: Call to undefined method Jenssegers\Mongodb\Query\Builder::createToken()

StevePorter92 commented 6 years ago

This sounds like your User model is missing the HasApiTokens trait.

You can find more information here https://laravel.com/docs/5.5/passport#installation.

<?php

namespace App;

use Laravel\Passport\HasApiTokens;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use HasApiTokens, Notifiable;
}

Hopefully this will fix your issue

StevePorter92 commented 6 years ago

@amittrigma i've added a new User class in this commit and published a new release https://github.com/StevePorter92/laravel-mongodb-passport/commit/59c36ae8862f25936880835b1485f1ed9d115456.

If update and have your User class extend StevePorter92\Mongodb\Auth\User, this should make your problems go away :)