0
我想在我的Android應用程序中集成谷歌。我使用oauth來檢索請求令牌,訪問令牌。我想要用戶的名字,姓氏,屏幕名稱,電子郵件。這就是我要做的,無法獲取用戶配置文件谷歌使用谷歌apis android
public static final String CLIENT_ID = "XXXX";
public static final String CLIENT_SECRET = "XXXX";
private static final String SCOPE = "https://www.googleapis.com/auth/userinfo.profile";
public static final String REQUEST_TOKEN_URL = "https://www.google.com/accounts/OAuthGetRequestToken";
public static final String ACCESS_TOKEN_URL = "https://www.google.com/accounts/OAuthGetAccessToken";
public static final String AUTHORIZE_URL = "https://www.google.com/accounts/OAuthAuthorizeToken";
我可以連接到Google要求授予的配置文件信息的訪問。用戶授予訪問權限,回到我的應用程序。現在我試圖做到這一點,
DefaultHttpClient httpClient = new DefaultHttpClient();
String strUrl = "https://www.googleapis.com/oauth2/v1/userinfo?alt=json";
HttpPost request = new HttpPost(strUrl);
得到用戶的配置文件。但作爲迴應,我只得到
{
無數據。我嘗試了很多以獲取用戶配置文件。 Plz告訴我我做錯了什麼。任何鏈接,示例代碼將不勝感激。提前致謝。