auth0 / laravel-auth0

Laravel SDK for Auth0 Authentication and Management APIs.
MIT License
245 stars 132 forks source link

Error in accessing the management API #387

Closed nanoray8888 closed 1 year ago

nanoray8888 commented 1 year ago

Laravel Version

Laravel 10.x

SDK Version

SDK 7.7

PHP Version

PHP 8.3

What happened?

Hello,

I followed the documentation for the management API found in this link - https://github.com/auth0/laravel-auth0/blob/main/docs/Management%20API.md. However, I encountered an error when trying to execute the code. Specifically, I received a 'Call to undefined method Auth0\Laravel\Auth0::management()' error."

Below is my sample code -

$management = app('auth0')->management();
dd($management);

How can we reproduce this issue?

na

Additional context

No response

evansims commented 1 year ago

Hi @nanoray8888 👋 Can you share the output of composer show --no-dev for me?

nanoray8888 commented 1 year ago

Hi @evansims,

Please check the output of composer show --no-dev below.

asm89/stack-cors                   v2.1.1   Cross-origin resource sharing library and stack middleware
auth0/auth0-php                    8.3.1    Auth0 PHP SDK. Straight-forward and tested methods for accessing Auth0 Authentication and Management API endpoints.
auth0/login                        7.1.0    Auth0 Laravel SDK. Straight-forward and tested methods for implementing authentication, and accessing Auth0's Management API endp...
brick/math                         0.9.3    Arbitrary-precision arithmetic library
dflydev/dot-access-data            v3.0.2   Given a deep data structure, access data by dot notation.
doctrine/inflector                 2.0.6    PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plura...
doctrine/lexer                     1.2.3    PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
dragonmantank/cron-expression      v3.3.2   CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
egulias/email-validator            2.1.25   A library for validating emails against several RFCs
fruitcake/laravel-cors             v2.2.0   Adds CORS (Cross-Origin Resource Sharing) headers support in your Laravel application
graham-campbell/result-type        v1.1.1   An Implementation Of The Result Type
guzzlehttp/guzzle                  7.4.5    Guzzle is a PHP HTTP client library
guzzlehttp/promises                1.5.1    Guzzle promises library
guzzlehttp/psr7                    2.4.0    PSR-7 message implementation that also provides common utility methods
laravel/framework                  v8.83.27 The Laravel Framework.
laravel/sanctum                    v2.15.1  Laravel Sanctum provides a featherweight authentication system for SPAs and simple APIs.
laravel/serializable-closure       v1.3.0   Laravel Serializable Closure provides an easy and secure way to serialize closures in PHP.
laravel/tinker                     v2.7.2   Powerful REPL for the Laravel framework.
league/commonmark                  2.4.0    Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)
league/config                      v1.2.0   Define configuration arrays with strict schemas and access values with dot notation
league/flysystem                   1.1.10   Filesystem abstraction: Many filesystems, one API.
league/mime-type-detection         1.11.0   Mime-type detection for Flysystem
monolog/monolog                    2.9.1    Sends your logs to files, sockets, inboxes, databases and various web services
nesbot/carbon                      2.66.0   An API extension for DateTime that supports 281 different languages.
nette/schema                       v1.2.3   📐 Nette Schema: validating data structures against a given Schema.
nette/utils                        v3.2.9   🛠  Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation...
nikic/php-parser                   v4.14.0  A PHP parser written in PHP
opis/closure                       3.6.3    A library that can be used to serialize closures (anonymous functions) and arbitrary objects.
php-http/discovery                 1.17.0   Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations
php-http/httplug                   2.4.0    HTTPlug, the HTTP client abstraction for PHP
php-http/message-factory           1.1.0    Factory interfaces for PSR-7 HTTP Message
php-http/multipart-stream-builder  1.2.0    A builder class that help you create a multipart stream
php-http/promise                   1.1.0    Promise used for asynchronous HTTP requests
phpoption/phpoption                1.9.1    Option Type for PHP
psr/cache                          1.0.1    Common interface for caching libraries
psr/container                      1.1.2    Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher               1.0.0    Standard interfaces for event handling.
psr/http-client                    1.0.2    Common interface for HTTP clients
psr/http-factory                   1.0.2    Common interfaces for PSR-7 HTTP message factories
psr/http-message                   1.1      Common interface for HTTP messages
psr/log                            1.1.4    Common interface for logging libraries
psr/simple-cache                   1.0.1    Common interfaces for simple caching
psy/psysh                          v0.11.8  An interactive shell for modern PHP.
ralouphie/getallheaders            3.0.3    A polyfill for getallheaders.
ramsey/collection                  1.3.0    A PHP library for representing and manipulating collections.
ramsey/uuid                        4.2.3    A PHP library for generating and working with universally unique identifiers (UUIDs).
spatie/laravel-package-tools       1.12.1   Tools for creating Laravel packages
swiftmailer/swiftmailer            v6.3.0   Swiftmailer, free feature-rich PHP mailer
symfony/console                    v5.4.22  Eases the creation of beautiful and testable command line interfaces
symfony/css-selector               v5.4.21  Converts CSS selectors to XPath expressions
symfony/deprecation-contracts      v2.5.2   A generic function and convention to trigger deprecation notices
symfony/error-handler              v5.4.21  Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher           v5.4.22  Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
symfony/event-dispatcher-contracts v2.5.2   Generic abstractions related to dispatching event
symfony/finder                     v5.4.21  Finds files and directories via an intuitive fluent interface
symfony/http-foundation            v5.4.22  Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                v5.4.22  Provides a structured process for converting a Request into a Response
symfony/mime                       v5.4.21  Allows manipulating MIME messages
symfony/polyfill-ctype             v1.27.0  Symfony polyfill for ctype functions
symfony/polyfill-iconv             v1.27.0  Symfony polyfill for the Iconv extension
symfony/polyfill-intl-grapheme     v1.27.0  Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-idn          v1.27.0  Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer   v1.27.0  Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring          v1.27.0  Symfony polyfill for the Mbstring extension
symfony/polyfill-php72             v1.27.0  Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions
symfony/polyfill-php73             v1.27.0  Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions
symfony/polyfill-php80             v1.27.0  Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions
symfony/polyfill-php81             v1.27.0  Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions
symfony/process                    v5.4.22  Executes commands in sub-processes
symfony/routing                    v5.4.22  Maps an HTTP request to a set of configuration variables
symfony/service-contracts          v2.5.2   Generic abstractions related to writing services
symfony/string                     v5.4.22  Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way
symfony/translation                v5.4.22  Provides tools to internationalize your application
symfony/translation-contracts      v2.5.2   Generic abstractions related to translation
symfony/var-dumper                 v5.4.22  Provides mechanisms for walking through any arbitrary PHP variable
tijsverkoyen/css-to-inline-styles  2.2.6    CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very ...
vlucas/phpdotenv                   v5.5.0   Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.
voku/portable-ascii                1.6.1    Portable ASCII library - performance optimized (ascii) string functions for php.
webmozart/assert                   1.11.0   Assertions to validate method input/output with nice error messages.
evansims commented 1 year ago

Hey @nanoray8888 👋

auth0/login                        7.1.0    Auth0 Laravel SDK. Straight-forward and tested methods for implementing authentication, and accessing Auth0's Management API endp...

You're currently on v7.1 of the SDK, you'll need to update to v7.7 to use that new management() method. 👍