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

Err while using custom route in pagebuilder config #60

Closed
macgadger opened this issue Dec 3, 2020 · 5 comments
Closed

Err while using custom route in pagebuilder config #60

macgadger opened this issue Dec 3, 2020 · 5 comments

Comments

@macgadger
Copy link

I am trying to use my own auth and crm. While i am logged into my CRM. I updated the url of pagebuilder config to

'pagebuilder' => [ 'class' => PHPageBuilder\Modules\GrapesJS\PageBuilder::class, 'url' => '/app/page/edit', 'actions' => [ 'back' => '/app/page/index' ] ],

while accessing this url i am getting this error

Authentication is disabled, use handlePublicRequest() and handleAuthenticatedRequest()

Please update on this Thanks!

@HansSchouten
Copy link
Owner

This means you have disabled the default authentication module. Therefore you need to provide your own controller methods, one that is a catch all request for all website pages which calls handlePublicRequest(). And one controller method for the pagebuilder in which you check that the user is authenticated and then calls handleAuthenticatedRequest().

Here you can read more details: #8

@macgadger
Copy link
Author

This means you have disabled the default authentication module. Therefore you need to provide your own controller methods, one that is a catch all request for all website pages which calls handlePublicRequest(). And one controller method for the pagebuilder in which you check that the user is authenticated and then calls handleAuthenticatedRequest().

Here you can read more details: #8

Thanks for Reply, i followed the #8 and end up with this error while registering singlton:

Error Class 'App\Providers\PHPageBuilder' not found

on AppServiceProvider

public function register() { // $this->app->singleton('phpPageBuilder', function($app) { return new PHPageBuilder(config('pagebuilder')); }); $this->app->make('phpPageBuilder'); }

Thanks

@HansSchouten
Copy link
Owner

HansSchouten commented Dec 9, 2020

The class PHPageBuilder is not part of the App\Providers namespace. You should add the following import at the top of your AppServiceProvider: use PHPageBuilder\PHPageBuilder;.

@macgadger
Copy link
Author

macgadger commented Dec 10, 2020

The class PHPageBuilder is not part of the App\Providers namespace. You should add the following import at the top of your AppServiceProvider: use PHPageBuilder\PHPageBuilder;.

Perfect! now i can access/views my pages i build in PageBuilder.

I can also access PageBuilder to edit Pages on custom Route like '/pages/1/build' or any other.

But when i try to access PageBuilder to edit pages with /admin/pages/1/build route or any route with /admin
i am getting this error Authentication is disabled, use handlePublicRequest() and handleAuthenticatedRequest()

Can you please explain with code how to fix it ?

Thanks!

@HansSchouten
Copy link
Owner

HansSchouten commented Dec 10, 2020

This means you have disabled the authentication module and thus cannot call the handleRequest() method, as this method does not have a way to check whether the user has been authenticated. You need two endpoints, a public controller action that calls handlePublicRequest() and a controller method that checks whether the user has been authenticated and then calls handleAuthenticatedRequest().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants