Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with creation of a Blog #5

Open
emoloic opened this issue Dec 2, 2022 · 2 comments
Open

Issue with creation of a Blog #5

emoloic opened this issue Dec 2, 2022 · 2 comments

Comments

@emoloic
Copy link

emoloic commented Dec 2, 2022

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.

@vksh-chandra
Copy link

vksh-chandra commented Mar 15, 2023

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: -

  1. we depend on oauth2 validation.
  2. In oauth2 file we are verifying the token received from login.
  3. 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.
  4. That will be caught at create router in the code and we will pass it to the create in the repository code.
  5. In this way we can get the current active user_name or id.

@vishnutej98
Copy link

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants