几个小时以来一直在与这个摔跤,Docs似乎很糟糕.基本上我正在尝试使用Portable Contacts API或完整的Contacts API获取对OAuth2经过身份验证的用户联系人的读取权限.谷歌最近开始允许使用OAuth2.
通过首先让用户对范围进行身份验证,我可以通过Contacts API访问用户联系人:"https://www.google.com/m8/feeds".然后我可以使用jQuery检索他们的前25个联系人(显示的代码是CoffeeScript)
$.ajax
url: "https://www.google.com/m8/feeds/contacts/default/full"
dataType: 'jsonp'
data: { access_token: token, alt: 'json-in-script' }
success: (data, status) ->
console.log "The returned data", data
Run Code Online (Sandbox Code Playgroud)
这有效,我得到JSON数据.然而,令人难以置信的差不多,唯一的接触下令谷歌提供了(据我可以告诉)是" 上次更改 "(严重跆拳道?).我需要更像"顶级朋友"或"最受欢迎"的东西.
这恰好是Google Portable Contacts API 可以做的事情(耶!).当然,我似乎无法获得成功的工作要求.
首先,我通过单击此链接让用户通过便携式联系人API进行身份验证(请注意范围:"https://www-opensocial.googleusercontent.com/api/people")
<a href="https://accounts.google.com/o/oauth2/authclient_id=457681297736.apps.googleusercontent.com&response_type=token&redirect_uri=http://localhost:3000/team&scope=https://www-opensocial.googleusercontent.com/api/people">Import Google Contacts</a>
Run Code Online (Sandbox Code Playgroud)
这工作正常,我得到一个访问令牌传回.
接下来,我尝试向便携式联系人API发送ajax请求
$.ajax
url: "https://www-opensocial.googleusercontent.com/api/people/@me/@all"
dataType: 'jsonp'
data: { access_token: token, alt: 'json-in-script' }
success: (data, status) ->
console.log "The returned data", data
Run Code Online (Sandbox Code Playgroud)
但是返回403错误
403 (The currently logged in …Run Code Online (Sandbox Code Playgroud) 如何使用Javascript获取已使用OAuth 2进行身份验证的用户的联系人?
身份验证已经完成,所以我只需要如何获取联系人列表.我已经读过Google Contacts Api 1和2有一些Javascript代码示例,但我在Google Contacts V3网站上找不到任何内容.难道这不能再做了吗?
从java开始通过Google API插入联系人时,我们从今天早上开始收到以下错误.请在下面找到堆栈跟踪
Exception while adding contact in google....
com.google.gdata.util.ServiceException: Internal Server Error
A temporary internal problem has occurred. Try again later.
at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(HttpGDataRequest.java:624)
at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(GoogleGDataRequest.java:563)
at com.google.gdata.client.http.HttpGDataRequest.checkResponse(HttpGDataRequest.java:552)
at com.google.gdata.client.http.HttpGDataRequest.execute(HttpGDataRequest.java:530)
at com.google.gdata.client.http.GoogleGDataRequest.execute(GoogleGDataRequest.java:535)
at com.google.gdata.client.Service.insert(Service.java:1409)
at com.google.gdata.client.GoogleService.insert(GoogleService.java:599)
Run Code Online (Sandbox Code Playgroud)
我们在插入线路时遇到此错误
ContactsService.insert(postUrl, contact)
Run Code Online (Sandbox Code Playgroud)
如果有人知道解决方案,请回复.
我有一个用例,我需要从 Chrome 网络选项卡检索启动器。这工作正常,除了以下情况:
在这种情况下,网络选项卡(以及调试协议上的任何扩展)显示对 iframe 内容的获取永远处于挂起状态,并且不会发出任何子负载。
将页面 URL 更改为 HTTPS,然后加载 iframe 并显示子加载。
如果我手动控制 Selenium 打开的浏览器并打开一个新选项卡,那么无论是通过 HTTP 还是 HTTPS 获取都没有关系。实际上,只有 webdriver 在加载时创建的选项卡似乎会受到这种影响。
是否有一些安全保护在起作用,或者这只是一个奇怪的错误?
webdriver google-contacts-api google-chrome-devtools selenium-chromedriver
这可能是一个愚蠢的问题,但我真的需要一个答案。
据我了解,从 Android 10 开始,推荐的方式是将文件保存到系统为其分配的应用程序的内部目录中。
在我的应用程序中,用户下载内容,然后可以(并且最经常这样做)使用 Uri 方案将其删除或导入到游戏中。当尝试以 这种方式保存文件时,我可以保存文件甚至删除它,但不能导入。保存到缓存不适合我的应用程序。有一些方法取决于设备上是否存在保存的文件。
但是,在 的帮助下DownloadManager,我可以从下载目录保存、删除和导入文件到游戏中。
问题:我可以将文件保存到 Android 11 及更高版本的下载文件夹中吗,如果不能,请告诉我另一种方式,以免违反任何规则。
非常感谢您的关注!
我正在使用Omniauth请求用户gmail凭据,因此我可以稍后请求用户朋友/联系人.
现在我正在使用身份验证请求为我生成的访问令牌获取OmniauthCallbacks控制器内的好友列表.像这样的东西
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def google
auth = env["omniauth.auth"]
gmail_contacts
....
end
.....
protected
def gmail_contacts
access_token = env["omniauth.auth"]['extra']['access_token']
response = access_token.request(:get,
"https://www.google.com/m8/feeds/contacts/default/full?max-results=10000")
.....
end
end
Run Code Online (Sandbox Code Playgroud)
如何使用我存储在数据库中的凭据来创建新的访问令牌,以便我可以从其他控制器调用google API?
我需要从 google 商务目录列表中获取联系人/电话列表。
我已经尝试过 Google 通讯录 api,它适用于“我的联系人”下的所有联系人,但不允许显示“目录”联系人。
我有什么用途/如何访问那些联系人(公司联系人)?
google-api google-contacts-api google-api-python-client google-admin-sdk
我使用从最近发布的谷歌的人API的例子在这里.我稍微扩展了一些示例,以显示有关联系人的其他信息,例如电子邮件地址和电话号码.应该完成这项工作的代码如下所示.
public class PeopleQuickstart {
...
public static void getPersonInfo(Person person){
// Get names
List<Name> names = person.getNames();
if(names != null && names.size() > 0) {
for(Name personName: names) {
System.out.println("Name: " + personName.getDisplayName());
}
}
// Get email addresses
List<EmailAddress> emails = person.getEmailAddresses();
if(emails != null && emails.size() > 0) {
for(EmailAddress personEmail: emails) {
System.out.println("Email: " + personEmail.getValue());
}
}
// Get phone numbers
List<PhoneNumber> phones = person.getPhoneNumbers();
if(phones != null && phones.size() > 0) { …Run Code Online (Sandbox Code Playgroud) 我想获得与给定的Gmail帐户相关联的电子邮件ID.这应该在我正在使用的本地服务器xampp server上完成Windows 7.
我使用下面的链接来获取Gmail联系人.
我已经完成了以下步骤:
在谷歌上创建项目,并激活联系人api.
粘贴client_id和client_secret_id.
google_redirect_uri ='http://localhost';
问题
当我点击import google contacts按钮时,它会将我重定向到谷歌的登录页面选择一个登录帐户,登录后网站要求我Allow Contact shares这样做?"
点击允许按钮后,它会将我重定向到xampp的默认索引页面,http://localhost/dashboard/因为在我设置的谷歌应用程序的重定向网址中http://localhost.
我尝试将重定向网址设置为根据我的文件程序路径联系谷歌的api,但它不允许我使用/所以我将其设置为:http://localhost代替http://localhost/contacts/index.php
那么在哪里可以看到我从谷歌联系api获得的回复?
我们正在尝试使用 CompanionDeviceManager 类将我们的 BLE 设备与我们的 Android(版本 10)手机配对,而无需位置许可。
出于测试目的,我们在测试设备周围激活了多部手机和 ble 设备的蓝牙。
我们正在使用官方网站上的示例代码,但没有成功。
将这些代码添加到 AndroidManifest 文件中:
<uses-feature android:name="android.hardware.bluetooth"/>
<uses-feature android:name="android.software.companion_device_setup"/>
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
Run Code Online (Sandbox Code Playgroud)
MainActivity 的完整代码:
public class MainActivity extends AppCompatActivity {
private CompanionDeviceManager deviceManager;
private AssociationRequest pairingRequest;
private BluetoothDeviceFilter deviceFilter;
private static final int SELECT_DEVICE_REQUEST_CODE = 42;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Log.e("ArkSigner", "onCreate called.");
deviceManager = getSystemService(CompanionDeviceManager.class);
// To skip filtering based on name and supported feature flags (UUIDs),
// don't include calls …Run Code Online (Sandbox Code Playgroud) android ×2
google-api ×2
java ×2
javascript ×2
oauth-2.0 ×2
api ×1
bluetooth ×1
gmail ×1
google-oauth ×1
omniauth ×1
php ×1
ruby ×1
webdriver ×1