Issue with creation of a Blog
Hello. Thanks for the tutorial. I would like to highlight that the function to create a blog is not completely done. We need to pass the user_id as an argument. But in this demo, this value is set to 1. This means all the blog created will be assigned to user with id=1.
Just understand the flow and you can fetch the current active username or id. In my case username is primary key in table. And in payload I had passed username and email_id. So while creating a new blog: -
- we depend on oauth2 validation.
- In oauth2 file we are verifying the token received from login.
- So in this case, where we are verifying the token we are returning nothing. Instead of that we can return username or any details from header section of token.
- That will be caught at create router in the code and we will pass it to the create in the repository code.
- In this way we can get the current active user_name or id.
@vksh-chandra , thanks for the tutorial, i was going through the above steps, unable to figure out how to fetch the user_id, can you please help us with the code?