2017-05-07 7 views
1

Google+とFacebookのログインボタンを実装し、アクセストークンを正常に取得しました。しかし私は私のサーバーにそれを保存しませんでした。新しいビジネスのために、私は認可されたユーザーの表示名とイメージを取得する必要があります。Google+ API、アクセストークンを持たないAPIを呼び出す

Facebookとの統合のために

、私が使用することができます。

https://graph.facebook.com/userId?fields=picture.width(720).height(720),name&access_token=APP_ID|APP_SECRET 

が不足しているアクセストークンなしのGoogle+のユーザー(画像、名前、電子メール...)の公開情報を取得するためのGoogle+のAPIのための任意の同様の方法がありますか?

+0

は[そう]へようこそ!このサイトでは、自分でコードを書くことができます**。 ** [もっと研究をして](// meta.stackoverflow.com/questions/261592)**あなたが問題を抱えていると、あなたが試みたものを投稿することができます** (** stackoverflow.com/help/mcve)を提供しています。私は良い質問と[完璧な質問]を読むことをお勧めします(http://codeblog.jonskeet.uk/2010/08/29/writing-the-perfect-question/)。また、[ツアー]を取って** [this](// meta.stackoverflow.com/questions/347937/)**を必ず読んでください。 – Badacadabra

答えて

2

Googleには、公開APIキーと呼ばれるものがあります。パブリックAPIキーは、パブリックデータにアクセスするためにのみ使用できます。だから問題のユーザーがプロファイルの公開に何かを設定していない場合、あなたはそれを見ることができません。

google developer consoleにアクセスする必要があります。そこにアプリケーションを登録すると、公開鍵を作成してgoogle + apiを有効にすることができます。

要求(最後のキーを注意してください):

GET https://www.googleapis.com/plus/v1/people/+LindaLawton?key=XXXXX

応答

{ 
"kind": "plus#person", 
"etag": "\"Sh4n9u6EtD24TM0RmWv7jTXojqc/t4cdVyNXc5UKH1p-n75jDwEzvvw\"", 
"occupation": "Google Developer Expert, BIA Developer at Targit", 
"skills": "Experience primarily in regards Microsoft products, Visual Studio, Bids, C# and asp.net. Past experience with PHP,JavaScript, MySQL and Linux. In recent years I have begun focusing on Business Intelligence, Data Warehousing, SQL Server/Analysis Services/Integration Services. Experience with OAuth2, Google Analytics API, Google Drive SDK.", 
"gender": "female", 
"urls": [ 
    { 
    ... 
    } 
], 
"objectType": "person", 
"id": "117200475532672775346", 
"displayName": "Linda Lawton", 
"name": { 
    "familyName": "Lawton", 
    "givenName": "Linda" 
}, 
"tagline": "Google Developer Expert 2014 - 2017", 
"braggingRights": "Extreme Beekeeper first to recorded an Hive inspection using Google Glass with out a veil on.", 
"aboutMe": "\u003cdiv\u003e\u003cb\u003eBackground\u003c/b\u003e\u003c/div\u003e\u003cdiv\u003e\u003cdiv\u003eI have been working as an application developer since 1995. I have worked with a number of database systems Oracle, Microsoft SQL Server, and MySQL.  In recent years I have been mainly working with Microsoft products, Visual Studio, SSIS, and C#.   I the past I worked a lot with web development PHP, JavaScript, Ajax, power-builder,  Cobol and ASP.net.\u003c/div\u003e\u003c/div\u003e\u003cdiv\u003e\u003cbr /\u003e\u003c/div\u003e\u003cdiv\u003eWhile I have done front end development in the past. I find working with backed development working on automated systems fascinating.    I have spent the last 5 years creating custom SSIS (Dlls), and services and APIs for the cloud (Azure).\u003c/div\u003e\u003cdiv\u003e\u003cbr /\u003e\u003c/div\u003e\u003cdiv\u003e\u003cb\u003eGoogle API Addiction\u003c/b\u003e \u003c/div\u003e\u003cdiv\u003eIn 2012 I began working with the Google APIs, starting with the Google Analytics API.  I learned to appreciate the fact that Google is so open and willing to give us access to their systems. I started blogging about how to use the APIs writing short tutorials with sample projects.   \u003ca href=\"http://www.daimto.com/\" rel=\"nofollow\" target=\"_blank\"\u003eDaimto - Data Import Tutorials\u003c/a\u003e.   This along with my presents on a number of \u003ca href=\"http://stackoverflow.com/users/1841839/daimto\" rel=\"nofollow\" target=\"_blank\"\u003eDeveloper forms\u003c/a\u003e lead me to discovered by Google.  I became one of the first \u003ca href=\"https://developers.google.com/experts/+LindaLawton\" rel=\"nofollow\" target=\"_blank\"\u003eGoogle Developer Experts for Google Analytics\u003c/a\u003e.  \u003c/div\u003e\u003cdiv\u003e\u003cbr /\u003e\u003c/div\u003e\u003cdiv\u003eI also help support the \u003ca href=\"https://github.com/google/google-api-dotnet-client\" rel=\"nofollow\" target=\"_blank\"\u003eGoogle APIs client Library for .NET\u003c/a\u003e which provides simple, flexible, and powerful access to Google APIs such as Drive, YouTube, Calendar, Storage and Analytics.\u003c/div\u003e\u003cdiv\u003e\u003cbr /\u003e\u003c/div\u003e\u003cdiv\u003e\u003cb\u003eLife\u003c/b\u003e\u003c/div\u003e\u003cdiv\u003eI grew up in a small town in \u003ca href=\"http://en.wikipedia.org/wiki/Dartmouth,_Massachusetts\" rel=\"nofollow\" target=\"_blank\"\u003eMassachusetts\u003c/a\u003e, USA, I moved to \u003ca href=\"http://en.wikipedia.org/wiki/Denmark\" rel=\"nofollow\" target=\"_blank\"\u003eDenmark \u003c/a\u003ein 1998 and have lived here since. I have a 22 year old daughter.  My hobbies include reading science fiction, painting, and gardening.   \u003c/div\u003e", 
"url": "https://plus.google.com/+LindaLawton", 
"image": { 
    "url": "https://lh5.googleusercontent.com/-a1CWlFnA5xE/AAAAAAAAAAI/AAAAAAAAdVM/sHkU9F-AwwQ/photo.jpg?sz=50", 
    "isDefault": false 
}, 
"organizations": [ 
    { 
    ... 
    } 
], 
"placesLived": [ 
    { 
    ... 
    } 
], 
"isPlusUser": true, 
"circledByCount": 1879, 
"verified": false, 
"cover": { 
    "layout": "banner", 
    "coverPhoto": { 
    "url": "https://lh3.googleusercontent.com/uDdUhB6o9WkVDpEft9VMBS5hm8nYTh2eCf_2RQ297u61U0y-98WBNSrlGvKz6ksHiuV20Rc-=s630-fcrop64=1,099f2649dfffc883", 
    "height": 696, 
    "width": 940 
    }, 
    "coverInfo": { 
    "topImageOffset": -7, 
    "leftImageOffset": 0 
    } 
} 
} 
関連する問題