Comments (4)
To do an AJAX request with the user already logged in you dont need JWT. JWT is designed for apps that have a completely separated front-end to backend example: Single Page Applications that need to authenticate with an API. Ember is a great JavaScript framework for that.
Based on what I'm seeing you're trying to send the _token
as an Authorization header. If you're using the _token
that is defined by default thats the CSRF token so you need to adjust your request as follows:
<input type="hidden" v-model="activity._token" value="window._token">
axios.post('/api/v1/activities', this.activity)
.then((res) => { console.log(res); })
.catch((err) => { console.error(err); })
}```
Then in the `master.blade.php` file you'll need to adjust the `_token` to `window._token` that should work then.
from builder.
Okay thank you for the explanation of using JWT. I think it's going to be easier to use the CRUD Maker pattern and similar type forms.
I spun up a new Grafite app to test the CRUD Maker and ran into an issue where in ActivateService:sendActivationToken auth()->user()->meta
is evaluating to null, after I ran the seeder.
Do you know why the meta relationship comes up null after running the seeder? (If this is better as a separate issue I can open it that way)
from builder.
Off the top of my head no, you'd have to check your database and confirm that that relationship exists.
from builder.
All good! Appreciate the help. I'm simplifying it by adding activities the old fashion way:
<form method="POST" action="/activities">
{{ csrf_field() }}
<input type="date" class="form-control" name="date">
<input type="text" class="form-control" name="title">
<input type="submit" value="Add Activity" class="btn btn-primary">
</form>
Down the line I'll get more comfortable with API interactions and the CRUD Maker. Awesome tool!
from builder.
Related Issues (20)
- How to create foreign key constraint using crudmaker? HOT 1
- Problem when generating a form with @form_maker_table directive and Semantic-Ui HOT 1
- Problem with bootstrap HOT 2
- App name/namespace not honoured HOT 2
- Cannot login when via web when using api guards and vice versa HOT 4
- composer install: symfony console error on laravel 5.6 HOT 2
- What happen with Laracogs? HOT 4
- Error during install HOT 1
- Fail to retrieve Activitity by user HOT 1
- Error on install
- Missing lines from LogsController.php HOT 2
- MySQL specific query on Blade template, it will fail with other DB engine HOT 1
- DB::select('SHOW VARIABLES ...') in /admin/dashboard.blade.php not postgres compatible HOT 2
- Change to socialite documentation HOT 1
- No emails folder in views HOT 1
- Bootstrap step in instructs results in broken webpack.mix.js
- Starter user registration is broken HOT 1
- 5.8 support? HOT 4
- Any 6.0+ love ? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from builder.