Giter Site home page Giter Site logo

auth0-samples / laravel Goto Github PK

View Code? Open in Web Editor NEW
44.0 28.0 59.0 7.42 MB

Laravel 9 application demonstrating Auth0 integration, using the Auth0 Laravel SDK.

Home Page: https://github.com/auth0/laravel-auth0

License: MIT License

PHP 83.34% JavaScript 0.24% Blade 16.42%
quickstart webapp auth0 authorization laravel php dx-sdk-quickstart

laravel's People

Contributors

aaguiarz avatar albertoperdomo avatar alexisluque avatar annyv2 avatar chenkie avatar cocojoe avatar crew-security avatar dependabot-preview[bot] avatar dependabot[bot] avatar evansims avatar glena avatar iannyanes avatar james-flynn-ie avatar jimmyjames avatar joshcanhelp avatar joshsalway avatar lbalmaceda avatar mehreencs87 avatar paulioceano avatar vmartynets avatar widcket avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laravel's Issues

Lock configuration

How can I configure the lock theme or set the initial screen with this setup?

Laravel SDK deletes port numbers by itself

I am creating a new project in Laravel8.
I installed the Auth0 SDK into Laravel with the following command.

$ composer require auth0/login

Then I set the "Allowed Callback URLs" of Auth0 as follows.

http://localhost:8080/auth0/callback

I wrote the code for the login part of Laravel as follows.

    public function login()
    {
        $authorize_params = [
            'scope' => 'openid email email_verified',
            // Use the key below to get an Access Token for your API.
            // 'audience' => config('laravel-auth0.api_identifier'),
        ];

        return app()->make('auth0')->login(null, null, $authorize_params);
    }

When this code is executed, the parameter of "redirect_url" will be "http://localhost/auth0/callback".
The port number will be erased by itself.

Why is this?

outdated dependencies

Sample using lock v10.2 when up-to-date version is 10.10 and dependencies like laravel/framework and auth0/login are outdated. (AUTH-3772)

How to implement universal logout?

We have clients that use Spotfire on their machines (separate credentials from Auth0) and what happens when they login to Auth0 is that they get signed in to Spotfire via Auth0 credentials. But when they Sign Out from Auth0, they’re not signed out from Spotfire license/credentials – is there a way to ensure they get signed out from Spotfire/Auth0?

"auth0/login": "^5.0"
Laravel Framework
public function logout()
{
Auth::logout();

$logoutUrl = sprintf(
    'https://%s/v2/logout?federated&client_id=%s&returnTo=%s',
    config('laravel-auth0.domain'),
    config('laravel-auth0.client_id'),
    config('app.url')
);

return Redirect::intended($logoutUrl);

return redirect()->route('home');

}

Auth0 Callback Type Error

Hey All,

I was following the tutorial here to integrate Auth0 into my Laravel app and I was running into this Exception on using the callback URL.

http://localhost:3000/auth0/callback is supposed to redirect to the home page but I get this error instead.

I then downloaded this sample application and ran into the same problem. Seems like login and logout still works however, so this URL test from the tutorial doesn't really matter. Can you please update the tutorial since it appears you do not need that callback URL to work? Or, fix the Auth0 controller to handle a null user? It was really confusing and I lost a lot of time trying to see what was wrong in my app.

Exception from 01-Login App:

TypeError:
Argument 1 passed to Auth0\Login\Repository\Auth0UserRepository::getUserByUserInfo() must be of the type array, null given, called in /home/app/vendor/auth0/login/src/controllers/Auth0Controller.php on line 37

  at /home/app/vendor/auth0/login/src/Auth0/Login/Repository/Auth0UserRepository.php:27
  at Auth0\Login\Repository\Auth0UserRepository->getUserByUserInfo(null)
     (/home/app/vendor/auth0/login/src/controllers/Auth0Controller.php:37)
  at Auth0\Login\Auth0Controller->callback()
     (/home/app/vendor/laravel/framework/src/Illuminate/Routing/Controller.php:54)
  at Illuminate\Routing\Controller->callAction('callback', array())
     (/home/app/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php:45)
  at Illuminate\Routing\ControllerDispatcher->dispatch(object(Route), object(Auth0Controller), 'callback')
     (/home/app/vendor/laravel/framework/src/Illuminate/Routing/Route.php:254)
  at Illuminate\Routing\Route->runController()
     (/home/app/vendor/laravel/framework/src/Illuminate/Routing/Route.php:197)
  at Illuminate\Routing\Route->run()
     (/home/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:692)
  at Illuminate\Routing\Router->Illuminate\Routing\{closure}(object(Request))
     (/home/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/home/app/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php:41)
  at Illuminate\Routing\Middleware\SubstituteBindings->handle(object(Request), object(Closure))
     (/home/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/home/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php:77)
  at Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(object(Request), object(Closure))
     (/home/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/home/app/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php:49)
  at Illuminate\View\Middleware\ShareErrorsFromSession->handle(object(Request), object(Closure))
     (/home/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/home/app/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:121)
  at Illuminate\Session\Middleware\StartSession->handleStatefulRequest(object(Request), object(Store), object(Closure))
     (/home/app/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:63)
  at Illuminate\Session\Middleware\StartSession->handle(object(Request), object(Closure))
     (/home/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/home/app/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php:37)
  at Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(object(Request), object(Closure))
     (/home/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/home/app/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php:67)
  at Illuminate\Cookie\Middleware\EncryptCookies->handle(object(Request), object(Closure))
     (/home/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/home/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103)
  at Illuminate\Pipeline\Pipeline->then(object(Closure))
     (/home/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:694)
  at Illuminate\Routing\Router->runRouteWithinStack(object(Route), object(Request))
     (/home/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:669)
  at Illuminate\Routing\Router->runRoute(object(Request), object(Route))
     (/home/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:635)
  at Illuminate\Routing\Router->dispatchToRoute(object(Request))
     (/home/app/vendor/laravel/framework/src/Illuminate/Routing/Router.php:624)
  at Illuminate\Routing\Router->dispatch(object(Request))
     (/home/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:166)
  at Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(object(Request))
     (/home/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:128)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/home/app/vendor/fideloper/proxy/src/TrustProxies.php:57)
  at Fideloper\Proxy\TrustProxies->handle(object(Request), object(Closure))
     (/home/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/home/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21)
  at Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(object(Request), object(Closure))
     (/home/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/home/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:21)
  at Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(object(Request), object(Closure))
     (/home/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/home/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27)
  at Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(object(Request), object(Closure))
     (/home/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/home/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/PreventRequestsDuringMaintenance.php:87)
  at Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance->handle(object(Request), object(Closure))
     (/home/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:167)
  at Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(object(Request))
     (/home/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:103)
  at Illuminate\Pipeline\Pipeline->then(object(Closure))
     (/home/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:141)
  at Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(object(Request))
     (/home/app/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:110)
  at Illuminate\Foundation\Http\Kernel->handle(object(Request))
     (/home/app/public/index.php:55)
  at require_once('/home/app/public/index.php')
     (/home/app/server.php:21)            

Outdated dependencies.

In the composer.json file, Laravel version is 5.3, the latest version is 5.4.

AUTH-3374

invalid_request: The redirect_uri parameter is not valid:

auth0error
Hi, I tried to integrate Auth0 into my laravel app according to Auth0 Laravel Quickstart,
made all the steps,

It redirects me to
https://wallter.eu.auth0.com/authorize?response_mode=query&scope=openid%20email%20email_verified&response_type=code&redirect_uri=local.accounts.wallter%2Fauth0%2Fcallback&client_id=UGvJrnvKhNZls8VPSUDTYEDxMwMCNcNp&state=5bcdeeb7627e75.25065676

wallter
Oops!, something went wrong
nvalid_request: The redirect_uri parameter is not valid: "local.accounts.wallter/auth0/callback" If url looks fine, check that you are not including non printable chars

I tried to google yet found nothing.
Any Idea? Can you please help?

Thanks,
Sincerely,
Avraham

Passwordless SMS and Laravel

how to implement passwordless login using Twilio SMS & Laravel?
when enabling the Passwordless SMS from the Auth0 dashboard, i'm getting at the login screen:

Something went wrong. Please contact Technical support

what changes should I do in Laravel to use Passwordless sms login.

Always getting Invalid State on login or signup

Hi,

I first followed your guide on my own laravel project and got an invalid state error, then I just downloaded this sample and I still get the invalid state error.

I triple checked that I have these fields in my settings

http://localhost:3000/auth0/callback to the Allowed Callback URLs field
http://localhost:3000 to the Allowed Web Origins field
http://localhost:3000 to the Allowed Logout URLs field

The env is loaded properly

I can't figure out whats missing, and the docs for that issue seem to be no help at all.

Any insight would be appreciated.

ConnectException

Hi there,
I am facing this issue from tomorrow.
exception: "GuzzleHttp\Exception\ConnectException"
file: "/var/www/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php"
line: 210
message: "cURL error 6: Could not resolve host: dev-xco1z9fm.auth0.com (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://dev-xco1z9fm.auth0.com/.well-known/jwks.json"

earlier it was running perfectly. i have not done any changes in any file.
I am using laravel-8 as backend and ReactJs as frontend.
Please help me with that.

Session not persistent when using database as session driver

Hi there,

Because of my production environment I need to use the database as a session driver. You do this by setting the SESSION_DRIVER in the .env file to database. Unfortunately whenever I try to login the Authentication with Auth0 wil succeed, but the Authentication inside of Laravel is not working. l keep getting redirected to the login page. Works fine when using "file" as SESSION_DRIVER.

Dependency update results in Laravel error "Cannot handle token prior to [timestamp]"

Both projects here (00-Starter-Seed and 01-Login) work flawlessly once downloaded and installed. However, upon running "composer update" to update dependencies, both projects throw the same error upon trying to login:

Auth0 \ SDK \ Exception \ CoreException
Cannot handle token prior to 2019-01-09T09:25:15+0000

Potentially stems the following dependency updates:

Updating auth0/auth0-php (5.1.0 => 5.3.2)
Updating auth0/login (5.0.2 => 5.1.0)

Googling around hasn't produced any fixes that work in this case. Would love to get this up and running again!

Error on logout in Laravel SDK.

I set up the SDK for Laravel using your help pages.
When the following code is executed, the I get the following error.

    public function logout()
    {
        Auth::logout();

        $logoutUrl = sprintf(
            'https://%s/v2/logout?client_id=%s&returnTo=%s',
            config('laravel-auth0.domain'),
            config('laravel-auth0.client_id'),
            config('app.url')
        );

        return Redirect::intended($logoutUrl);
    }
There could be a misconfiguration in the system or a service outage. We track these errors automatically, but if the problem persists feel free to contact us.
Please try again. 

Please tell me how to fix this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.