Hello please I'm working on a VTU website using Laravel 11 as the backend and a native app. I want to make my website's API accessible to other VTU websites, allowing them to buy data just like my native app users can. Instead of creating separate endpoints for API and native app users, I thought of using the same endpoint for both. However, I'm unsure how to handle authentication and authorization. I noticed that the Sanctum token isn't a unique key that always returns the same value. Please help me understand how to approach this and secure my API. Thank you!
This was great! But could you explain why, for me: ```{ data } = await axios.post( "localhost:8000/api/login", { email, password, device_name }, { headers: { Accept: "application/json" }, } ); console.log(data);``` returns: ```HTTP/1.0 200 OK Cache-Control: no-cache, private Content-Type: application/json Date: Sat, 24 Aug 2024 08:10:30 GMT {"token":"my_token"}``` I'm not able to access the token with such a response, as data.token just returns undefined. I'm returning the response using response()->json() EDIT: I can explain it myself now. I was trying to be smart by type-hinting my login controller method in Laravel. I provided 'string' as the type, because I was thinking I'm returning JSON, which is a string, right? But of course the response itself should still be an object. So I removed the type hint and now it works as it's supposed to!
Hi, I'm new to Go with basic understand of language without any web related stuff in Go. You please do a video on previous parts before authentication? Like how to start the server, how to add routes, how to render some html and connect to db?
@@cdruc Wonderful. Thanks. Cant wait for more Golang stuff like full blown REST API, Microservices, gRCP. Wouldn't mind paying for a course, your teaching style is great. 😊
Cool way to do things personally when I did create my own implementation of logins for my project I go to the route of generating HttpOnly JWT token with the user id to track which user is logged but session cookies are great too. I just didn’t wanted to rely on external database to store the session Id and third party solutions to add session cookies. But I still see the benefits of using session to extends user logged or auto kick users when passwords change. (That’s not impossible with JWT but a little more harder)
hi teacher, i am trying to set default selected value of the listbox with the data coming from an api. the data is in form of array of object like {id:1,name:'London',time:'...'}. For example i want to set the default selected value 1 and the label as 'London' on first page load. How can i achieve this, thanks for the great video
Hello Sir. Thank you for your content, I really like it. Please how to prevent Ziggy from exposing routes in browser source code using inertia js and Laravel?
you cannot do that. otherwise you wouldnt be able to access them at all. maybe you want to hide a couple of them? not sure if such option exists (but it should!)
@@lionelagondanou7142 not really - at least not in a serious way. Just because I know a link, doesn't mean I can DO something with it. If there are links that should be accessible only for specific kind of users, ensure you protect those with a middleware. For example: I know the USA White House address. That doesn't mean I can just barge in 😀
Hello Sir. Thank you for your content, I really like it. Please how to prevent Ziggy from exposing routes in browser source code using inertia js and Laravel
Very informative thanks! what's the VS Code database extension in ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-qmXrYZavQIc.html edit: found qwtel.sqlite-viewer
At 07:28 I should have used the f.Errors.Add(field, message) method 😪Like this: f.Errors.Add(field, "This field cannot be empty.") Same for the MaxLength validation method. Code snippets: github.com/druc/posty
As a full time Laravel developer, all I can say is that I wish a framework as fully fledged and widely used as it was available in a statically typed compiled language like Go…
10:08 You can also maintain the state on the browser without involving the backend move all the input fields out of the form element and only keep the button inside the form element, then give the form element an id then add the attribute called form in the input which will be the id of the form element, with this you have successfully maintained state without server
Great video, cdruc! I've been dabbling with Go for the past few weeks, but I have not touched the HTTP side of it so far, still getting used to the syntax, concurrency and stdlib modules/functions. If you have some time, I got a few questions: 1. Is using the internal HTTP package and basically implementing everything from scratch the professional way of building HTTP services in Go? I have seen people from the Go community advising against pulling externals libraries. 2. As of the final state of the application, how testable are the endpoints? 3. And finally, can you share some libraries that you're always pulling in Go projects?
Thanks! To be honest I'm a Go newbie myself - so I'm not in a position to recommend *any* package right now. From what I understand, the net/http library wasn't that great in the past (no way to specify the request method, no named parameters, etc) - and that's why people turned to things like gin, chi, *whatever*. Yes, the Go community is mostly against using packages. Everybody glorifies the stdlib - which is indeed, great (but probably not THAT great to be outraged when someone asks about libraries lol). Right now I try to build things using *only* the stdlib but just because "I want to do it myself so I can learn more/better/faster", not because "uSiNg PaCkAgEs Is BaD". Basic testing seems nice but haven't really delved into HTTP testing (doesn't look fun though, lots of boilerplate needed). Good luck with your learnings!
I usually can't withstand coding tutorial videos for their long pauses, introductions and intro animations and so on, but this format is just PERFECT. Thank you so much!
Unrelated to the topic. Can I ask you what theme you are using? I watched your other videos, and I find the theme pleasing to my eyes. So I'm kind of curious.