Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do you combine Auth0 Lock with Laravel Auth0? #102

Closed
edmandiesamonte opened this issue Apr 9, 2018 · 3 comments
Closed

How do you combine Auth0 Lock with Laravel Auth0? #102

edmandiesamonte opened this issue Apr 9, 2018 · 3 comments
Milestone

Comments

@edmandiesamonte
Copy link

Is there a way to combine Auth0 Lock with Laravel Auth0?

Auth0 Lock supports responseType=code, and I'm planning to use Laravel Auth0 to handle the callback. Unfortunately, Laravel Auth0 has a stateful approach but there's no exposed function to issue a state token to the blade template.

Maybe changing the private properties and functions of Auth0Service is a good start so we could override and customize its behaviour?

I hope you could help. Thanks.

@joshcanhelp
Copy link
Contributor

Hi @edsamonte,

This Laravel library is built on top of our PHP SDK and the callback handling is the same whether you use the hosted login page or Lock. You can stop the PHP SDK from handling state by passing in a dummy state handler on initialization. Then you can generate and store a value, pass that to Lock, and check within the callback.

That said, the options used to initialize the PHP SDK are loaded from the config file so you could pass that same dummy state handler in by default and handle state validation yourself. I have not tried this specifically so if you get stuck, let me know and I'm happy to help!

@edmandiesamonte
Copy link
Author

Thanks for the suggestion, @joshcanhelp.

Though, it is not a good idea to create instantiated object on the config file. Config values should be as primitive as possible.

As a workaround, I just create a BootServiceProvider which is at the very first of all the service providers which sets the laravel-auth0.state_handler:

// BootServiceProvider
public function boot(){
    config([
        'laravel-auth0.state_handler' => new MyCustomStateHandler(new SessionStore())
    ]);
}

@joshcanhelp
Copy link
Contributor

I should have mentioned, you can also just pass in false and the dummy one will be used.

@joshcanhelp joshcanhelp reopened this Apr 10, 2018
@joshcanhelp joshcanhelp added this to the 5.1.1 milestone Jun 27, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants