0

I would think this question has been asked 1,000 times, but I actually haven't been able to find it anywhere (at least not for Laravel 5.2). I'm trying to implement user admin functionality through a RESTful API (I'm not talking about OAuth2, I already got that up and running). Basically, I need all the stuff Route::auth() does through a web interface, but I want to do it without the web interface and without the redirects that Route::auth() returns.

It seems like I can send POST requests to the underlying routes of Route::auth() (register, login, logout, password...) and it properly validates the POST and acts, but there's no useful data returned and it always redirects to / as the response. For example, if I register a new user, it creates the account correctly and redirects to /, but there's no "success" message. If I try to register a new user with an email address that's already in the user table, it catches that the user already exists and does not create a duplicate, but the response doesn't indicate that. It still just redirects to / with no other response. I don't get any sort of error code or message to tell my app that the user already exists.

Before anyone links to jwt-auth, I've looked at it already and I don't think it does what I'm talking about here.

Is there something I'm missing or do I need to re-write all of these routes and auth methods for proper API functionality?

3
  • I'm still struggling with this and haven't gotten anywhere. I've tried dissecting the app to figure out how to get this working, but it's pretty hard to follow. It looks like the post to /register route generates a variable $errors, but I can't figure out how to just return that to the client instead of the blade template.
    – jreikes
    Jun 30, 2016 at 13:54
  • Looks like there's a thread about this, but I don't see an answer in here that works for 5.2: laracasts.com/discuss/channels/laravel/…
    – jreikes
    Jun 30, 2016 at 21:23
  • I ended up resolving this by writing a new auth controller for restful calls.
    – jreikes
    Jul 18, 2016 at 20:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.