If you are talking about a specific website, you should use a content script with match patterns for that specific website.
Most of the times, simple things work. You find the relevant fields (username, password), change their value and trigger a click on a submit button (for example, submitButton.click()), or submit the form (for example, form.submit()).
Some websites have irregular login scripts that require fake input events (keydown, keyup or keypress) and fake focus events to be triggered on the fields. You will have to experiment to find out.