0

I have been following the tutorial in https://medium.com/@flicher/laravel-rest-api-passport-authentication-for-ionic-app-3934713bcdf7 but having some trouble with the response when testing registration..

Registration is successful and the expected response by the ionic APP is JSON but the laravel response contains headers as well as JSON and returns as

<!-- CSRF Token -->
<!--
<meta name="csrf-token" content="{{ csrf_token() }}">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<script src="{{ asset('vendor/file-manager/js/file-manager.js') }}"></script>
-->
{"message":"Successfully created user!"}

Giving me the HttpResponseError

Unexpected token < in JSON at position 1

despite the registration being successful

1 Answer 1

1

Edited the options section of the post request to recieve response as text not JSON.

Sign up to request clarification or add additional context in comments.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.