Error in accessing twitter api in R



I am a newbie on R. I am practicing text mining couple of days.

When firewall was turned off below code snippet was working smoothly. As soon as i have turned it on i am getting the below error :

Error in check_twitter_oauth() : OAuth authentication error:
This most likely means that you have incorrectly called setup_twitter_oauth()’

Because of the problem, I have again turned firewall off, restarted the PC, ran the program in new session, and also regenerated the all keys and search for answers but I still have same problem. Any help will be appreciated. Note installed packages are up to date and i have also installed the package “base64enc” but no luck.

Here is the code snippet:

key <- "your API key from twitter"
secret <- "your Secret key from twitter"
secrettk <- "Access Token Secret from Twitter"
mytoken <- “Access Token from Twitter”

setup_twitter_oauth(key, secret, mytoken, secrettk)

(1) choose direct authentication

My sessionInfo()
R version 3.4.3 (2017-11-30)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows >= 8 x64 (build 9200)

Matrix products: default

[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] base64enc_0.1-3 httr_1.3.1 twitteR_1.1.9

loaded via a namespace (and not attached):
[1] bit_1.1-12 compiler_3.4.3 rjson_0.2.15 R6_2.2.2 DBI_0.7 tools_3.4.3
[7] curl_3.1 bit64_0.9-7 openssl_0.9.9