Comments (6)
@shalvah Thanks for the input; apologies for the ghosting. We had our baby shortly after I posted this so I've been away from work for a while. I'll give this a shot! 🍻
from scribe.
It appears this is happening because the FormRequest is processed before an actual API call is made; therefore using a Middleware to create a fake user and force authentication won't work.
When extracting body parameters (which is where the error occurs), the FormRequest's rules() method is being processed directly, no API calls made. In your particular scenario, changing your code to Auth::id()
should fix that null exception, I believe.
from scribe.
For the broader scenario of dynamically authenticating for response calls when there's no database (like in CI): Right now, Scribe doesn't have an easy way of supporting your workflow yet, but there may be something in the works. I'd recommend using a custom strategy: extend the ResponseCalls strategy and add code in there that properly authenticates Scribe. See this example.
from scribe.
Hey @ellisio did you try the suggestion?
from scribe.
@shalvah Seems to work for me
from scribe.
Thanks @gazben . Closing this now.
from scribe.
Related Issues (20)
- only name & example supported in the header HOT 1
- Always ask to remove external.html_attributes.* on scribe:generate for no reason HOT 2
- Strategy ResponseCalls running on all endpoints instead of only GET endpoints HOT 4
- getting 401 Unauthorized in each routes where i set the middleware HOT 1
- Plugin List?
- How to override post-response script content for the postman? HOT 1
- Using @apiResource as a @bodyParam? HOT 1
- scalar theme doesnt properly generate example and child attributes HOT 1
- array request not render and not examplae
- Example is not using factory HOT 1
- Missing 'Accept' => 'application/json' HOT 5
- How to send NULL values? HOT 2
- Support wider range of types
- How use recursive schema ? HOT 1
- 404 Not Found on Production HOT 6
- Multiple responses do not generate oneOf correctly
- The package is ending with a Check Failed Error HOT 1
- Badges don't work with element theme HOT 3
- Response fields overflows to dark box on default theme
- Theme Dark Mode Support HOT 1
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 scribe.