Error with accessing the public API


Hi all,
I am trying to connect to the omdbapi -

My code is here-

#Setting the working directory

#install R package omdbapi
devtools::install_github("hrbrmstr/omdbapi",force = TRUE)

#connecting to the api

#to search a movie name
search_by_title("Captain America")

But it is showing some Unauthorised error 401.Then I generated the API key but please help me with the function through which I can put the API key and get access to the api.

Thanks in advance