Story points are assigned to user stories as part of the process of creating the user stories. Alternatively, you can also add the story points prior to starting a Sprint (e.g. during the Sprint Planning session).
Do I need to have all my users stories ready before starting a project?
Who is responsible for documenting user stories?
How can I manage subtasks that are part of a user story in Trello?
How do you know how many user stories you should add in a Sprint?
Do all stories in the backlog get assessed for story points or only the ones that make it into a Sprint?
Who assigns user stories?