crubba / Wiley-ADCR

Repository for the book "Automated Data Collection with R"
41 stars 76 forks source link

about OAuth2.0 code #15

Open woshiisp opened 4 years ago

woshiisp commented 4 years ago

I tried practising codes on Page 218-221.In testing,I had many difficluts.I used API of Baidu(in China Facebook cannot touch). I am confused . Codes like that :

library(httr) baidu <- oauth_endpoint(authorize = "http://openapi.baidu.com/oauth/2.0/authorize",access = "https://openapi.baidu.com/oauth/2.0/token")

Sys.setenv(BAIDU_CONSUMER_SECRET = "jzkyL77Ywv72dEUDkgh4e5tWti736YE3")

baidu_app <- oauth_app("baidu","yFVhYeERjXmiSxe4KNq1dOivm15VszuX")

permissions <- "basic,super_msg,netdisk"

baidu_token <- oauth2.0_token(baidu,baidu_app,scope = permissions,type = "application/x-www-form-urlencoded") Waiting for authentication in browser... Press Esc/Ctrl + C to abort.........................

Baidu page warning list :+1: 错误代码:redirect_uri_mismatch 错误信息:Invalid redirect uri 详细描述:授权回调页地址错误,具体内容请开发者参考“redirect uri”验证方式

console address :http://developer.baidu.com/console#manage/safe!appid=18448279

But I had setup in console, I want to know why ?