Read this book Web Security for Developers
Web Security for Developers book and the author's website too: https://www.hacksplaining.com