API 콘솔에서 [email protected]
이하로 프로젝트를 만들었으며 Analytics API
및 Search Console API
서비스에 대한 서비스 계정을 성공적으로 사용하고 있습니다. 나는 지금 Gmail V1
API를 사용하도록 설정하고이 코드를 실행했습니다서비스 계정이 포함 된 Gmail API
gmail_scopes = [
"https://mail.google.com/",
"https://www.googleapis.com/auth/gmail.compose",
"https://www.googleapis.com/auth/gmail.readonly",
"https://www.googleapis.com/auth/gmail.send",
"https://www.googleapis.com/auth/gmail.readonly"
]
gmail = Google::Apis::GmailV1::GmailService.new
gmail.authorization = Google::Auth.get_application_default(gmail_scopes)
이 내가 웹 로그 분석에 권한을 부여하고 콘솔 API를 검색하는 데 사용하는 (물론 다른 범위와) 같은 코드입니다.
나는이 프로그램을 실행할 때 나는 BAD REQUEST
Failed Precondition
오류를 얻을 그러나 :
gmail.get_user_profile("[email protected]")
입니다 process [email protected]
을 포함시켜야 API 서비스가 해당받은 편지함을 사용할 수 있습니다.
어떻게하면됩니까?
나는 다음을 시도했다 '...'항상 이메일 주소를 @ gmail.com 사서함에 액세스 할 수 없습니다
gmail.authorization = Google::Auth.get_application_default(gmail_scopes, username: '...')
gmail.authorization = Google::Auth.get_application_default(gmail_scopes, {username: '...'})
gmail.authorization.username = '...'