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

/api/login/user => Internal Server Error #17

Closed
RoToK4 opened this issue Nov 18, 2022 · 14 comments
Closed

/api/login/user => Internal Server Error #17

RoToK4 opened this issue Nov 18, 2022 · 14 comments

Comments

@RoToK4
Copy link

RoToK4 commented Nov 18, 2022

Hallo zusammen,
irgendwie ich bekomme es nicht hin einen Token zu generieren...
Über den Login "/api/login/user" bekomme ich folgende Antwort
Array ( [type] => https://tools.ietf.org/html/rfc2616#section-10 [title] => An error occurred [status] => 500 [detail] => Internal Server Error )

Ich habe bis jetzt nichts weiter gemacht als die Erweiterung zu installieren, hat da jemand eine Idee? Ich stehe ein wenig auf dem Schlauch...

Vielen Dank im Voraus!!!

@koertho
Copy link
Contributor

koertho commented Nov 22, 2022

Hallo, ein paar mehr Details sind immer notwendig: Contao-Version, Bundle-Version und PHP-Version. Außerdem immer gut die Fehlermeldung im Debug-Modus

@RoToK4
Copy link
Author

RoToK4 commented Nov 23, 2022

Guten Morgen!
Entschuldige, hier noch die weiteren Details:
Contao-Version 4.13.10
Bundle-Version 2.2.3
PHP-Version 7.4.32

Folgenden Code nutze ich:
$ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://dev.Seite.de/api/login/user'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_USERPWD, 'BACKEND_BENUTZER' . ':' . 'PW_AUS_DB');

Bei den Daten zu "CURLOPT_USERPWD" bin ich mir gar nicht sicher ob das so korrekt ist.

Und folgende Antwort bekomme ich dann:
Array ( [type] => https://tools.ietf.org/html/rfc2616#section-10 [title] => An error occurred [status] => 500 [detail] => Internal Server Error )

In der Log-Datei steht folgenes:
request.INFO: Matched route "api_login_user". {"route":"api_login_user","route_parameters":{"_route":"api_login_user","_format":"json","_token_check":false,"_scope":"api_login_user","_entity":"huh.api.entity.user","_controller":"HeimrichHannot\\ApiBundle\\Controller\\LoginController::loginUserAction"},"request_uri":"https://dev.Seite.de/api/login/user","method":"POST"} []

request.CRITICAL: Uncaught PHP Exception TypeError: "Argument 1 passed to Symfony\Component\Translation\Translator::setLocale() must be of the type string, null given, called in /XXXXX/vendor/contao/core-bundle/src/Translation/Translator.php on line 72" at /XXXXX/vendor/symfony/translation/Translator.php line 151 {"exception":"[object] (TypeError(code: 0): Argument 1 passed to Symfony\\Component\\Translation\\Translator::setLocale() must be of the type string, null given, called in /XXXXX/vendor/contao/core-bundle/src/Translation/Translator.php on line 72 at /XXXXX/vendor/symfony/translation/Translator.php:151)"} []

@fritzmg
Copy link
Contributor

fritzmg commented Nov 23, 2022

This will be fixed by #18

@RoToK4
Copy link
Author

RoToK4 commented Nov 23, 2022

Vielen Dank, das habe ich eingebaut. Jetzt bekomme ich einen neuen Fehler:

[2022-11-23T12:19:56.328457+01:00] request.CRITICAL: Uncaught PHP Exception UnexpectedValueException: "The "HeimrichHannot\ApiBundle\Security\UsernamePasswordAuthenticator::getUser()" method must return a UserInterface. You returned "HeimrichHannot\ApiBundle\Entity\User"." at /XXXXX/vendor/symfony/security-guard/Provider/GuardAuthenticationProvider.php line 124 {"exception":"[object] (UnexpectedValueException(code: 0): The \"HeimrichHannot\\ApiBundle\\Security\\UsernamePasswordAuthenticator::getUser()\" method must return a UserInterface. You returned \"HeimrichHannot\\ApiBundle\\Entity\\User\". at /XXXXX/vendor/symfony/security-guard/Provider/GuardAuthenticationProvider.php:124)"} []

@fritzmg
Copy link
Contributor

fritzmg commented Nov 23, 2022

@koertho any particular reason you are using your own entity and not using the Contao user provider?

@koertho
Copy link
Contributor

koertho commented Nov 23, 2022

@fritzmg I haven't developed this bundle, so, no ;)

@fritzmg
Copy link
Contributor

fritzmg commented Nov 23, 2022

Well it was directed at huh in general and you are the top contributor: https://github.com/heimrichhannot/contao-api-bundle/graphs/contributors

@koertho
Copy link
Contributor

koertho commented Nov 23, 2022

@koertho is me, not the whole company ;) and I'm just the top contributor cause I'm the poor man needs to update all the old project :P
Maybe I find time soon to look into it, but currently it's not looking good.

@fritzmg
Copy link
Contributor

fritzmg commented Nov 23, 2022

May be @RoToK4 can sponsor/hire someone for a PR :)

@koertho
Copy link
Contributor

koertho commented Nov 23, 2022

Please hire, my todo list ist very looooong :D
(we're hiring, if someone interested ;) (https://www.heimrich-hannot.de/de/jobs/backend-entwickler-m-w-d))

@RoToK4
Copy link
Author

RoToK4 commented Nov 23, 2022

@fritzmg Can we hire/sponsor you? ;-)

@fritzmg
Copy link
Contributor

fritzmg commented Nov 23, 2022

Our todo list is also long 😬. But you could write to office@inspiredminds.at to figure out any details.

@RoToK4
Copy link
Author

RoToK4 commented Nov 24, 2022

So this isn't an error that can just be fixed?

Ok, I will write you.

@koertho
Copy link
Contributor

koertho commented Nov 24, 2022

Ok, I created to pull request to fix this issue, in a local instance it worked. See #19

I close this issue as the original error already fixed, the second error is already reported in #16

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

3 participants