Equivalent feature from \OC

Hello,

I hope you’re having a pleasant week !

I’m using 2 OC classes in my application and as it is not recommended, I’d like to find alternatives.

I’m looking for alternatives for:

  1. \OC::$server->getCSRFTokenManager()— to populate my settings form in the backend
  2. \OC\Search\SearchComposer — used to obtain the list of providers

Notes:

For 1. I want to avoid the inclusion of the Nextcloud’s password popin in my code (it has nothing to do there) and make my settings form as dumb as possible.

Regarding 2., my goal is to provide configuration of my “the search page” application to reduce the available provider based on user groups. Without the ability to fetch the group in the backend, this feature is not really feasible.

Thanks in advance

Hey there!

for #1 if you use the nextcloud/axios library to send requests to your backend, it will make use of the CSRF token automatically, so you don’t need to inject it manually. You can also get it from OC.requesttoken in the front end.

2 Likes

Thanks,

I wanted to avoid that to not have to create a js bundle for the settings page. My current version is just using an html form that, except for that OC issue, is functioning properly