What is the difference between the userId and the userProfileId that the following URL returns?
http://www.google.com/reader/api/0/user-info
(sign-in to google required to see the json results from the above URL")
The userId seems to be the ID of your google reader account.
While userProfileId is the ID of your Google Plus Account
So, you would access all items in your Google Reader Account with: http://www.google.com/reader/view/#stream/user/{UID}/state/com.google/reading-list.
Your Google Plus account would be at: https://plus.google.com/{userProfileId}
Related
I'm trying to login with Linkedin and Firebase. I generate on my server the custom token, I have my private key, I use RS256 and this is my payload:
"iss" : service_account_email
"sub" : service_account_email
"aud", "https://identitytoolkit.googleapis.com/google.identity.identitytoolkit.v1.IdentityToolkit"
"iat", Date().timeIntervalSince1970
"exp", Date().timeIntervalSince1970.advanced(by: 3600)
"uid", String.randomString(length:28)
I create the token, send it back to the app and from this I do:
Auth.auth().signIn(withCustomToken: token!, completion: { (user, error) in
I receive no error and a user back, so the token is valid. The problem is that the user has no values (no email, no displayName etc). the only thing is the uid which is the one that I set with: String.randomString(length:28)
How can I retrieve the user email and other info? In my linkedin account I have a displayname, email, picture etc. But here nothing.
Thanks
You have to set that manually. Firebase Auth has APIs to update profile (photo URL and display name) as well as email. You can send this LinkedIn data along with the custom token to your app, sign in with custom token and then update profile and email on that signed in custom token user.
By the way, set the LinkedIn ID as the UID for that user. Do not use a random string. Otherwise the next time you sign in with LinkedIn, the same user will map to another one.
I want to provide a "Login with twitter" functionality for my web application.When the user logs in, I want to request him to share specific information about his profile and tweets as I want to read that information and build some recommendations based on that. However, I do not know what all information can be had from this twitter for that user. Can you please point me to some code/docs that help me do this.
Thanks
kabir
<?php
require_once('config.php');
// Get consumer key and consumer secret from config file
// retrieve access token stored in database
require_once('twitteroauth.php');
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, OAUTH_TOKEN, OAUTH_TOKEN_SECRET );
$response = $connection->get('account/verify_credentials');
// This returns an object with the following info (user account info)
// [https://dev.twitter.com/rest/reference/get/account/verify_credentials][1]
$response2 = $connection->get('statuses/home_timeline');
// This returns an object with the following info (user timeline tweets)
//https://dev.twitter.com/rest/reference/get/statuses/home_timeline
?>
I'm running a service where people can connect their Google account using oauth 2.0, and with YouTube permissions I can manage their channels/access their YouTube Channel ID.
However, my question is whether or not you can go backwards. i.e. How can you determine the Google Account Owner from a given YouTube channel ID?
googlePlusUserId is now deprecated from
https://developers.google.com/youtube/v3/docs/channels#properties
contentDetails.googlePlusUserId no longer exists as part of the contentDetails part.
Based on this excerpt from their change-log
June 13, 2016
This update contains the following changes:
The channel resource's contentDetails.googlePlusUserId property has
been deprecated. Previously, the property was only present if the
channel was associated with a Google+ profile. Following the
deprecation, the property will no longer be included in any channel
resources.
The comment resource's snippet.authorGoogleplusProfileUrl
property has been deprecated. Previously, the property was only
present if the channel was associated with a Google+ profile.
Following the deprecation, the property will no longer be included in
any comment resources.
Since neither of these properties will be
returned following the deprecation, both properties have been removed
from the corresponding resource documentation.
Probably people can not get Google+ ID from YouTube API(v3). But even the channel owner did not create google plus account, you can know it in advance on the channel HTML document by using XHR or curl.
visit channel page.
https://www.youtube.com/channel/UCL8ZULXASCc1I_oaOT0NaOQ
Catch Javascript object from Developer tool on browser at the page.
ytInitialData.metadata.channelMetadataRenderer.ownerUrls
[ "http://www.youtube.com/user/googlechrome",
"https://plus.google.com/100585555255542998765" ]
Second one is always google plus address and the number is Google+ ID. You can get more info from ytInitialData at the channel page if necessary.
One example.
https://www.youtube.com/channel/UCiQPrVjbUlZBWY0fVtvpoKg
About that channel id(UCiQPrVjbUlZBWY0fVtvpoKg) You can not get Google+ ID from YouTube API(v3), but you can get Google+ ID at the channel directly when you can access html document or read it. Even if the channel owner did not create google plus account, the Youtube already made Google+ ID together.
You can get user Google+ ID through a YouTube API(v3) request, e.g.:
https://www.googleapis.com/youtube/v3/channels?part=contentDetails&id={CHANNEL_ID}&key={YOUR_API_KEY}
Will return:
{
"kind": "youtube#channelListResponse",
"etag": "fooHash",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [{
"kind": "youtube#channel",
"etag": "fooHash",
"id": "fooHash",
"contentDetails": {
"relatedPlaylists": {
"likes": "fooHash",
"favorites": "fooHash",
"uploads": "fooHash"
},
}
"googlePlusUserId": "{ID}"
}]
}
I am new to OAuth, and want to get the user ID (an email address) from Google using OAuth.
But I don't want to get the user's Google Contacts Information.
We can get google Email address only not the contacts by making the scope of request token Like :
"https://www.google.com/accounts/OAuthGetRequestToken?scope=https://www.googleapis.com/auth/userinfo#email";
Now do a authorized call to get the response like :
var responseText = oAuthConsumer.GetUserInfo("https://www.googleapis.com/userinfo/email", consumerKey, consumerSecret, token, tokenSecret);
Here by saying authorized call mean to make the HTTP Get request with required paramaters in header.
header string should contain: realm, consumerKey, signatureMethod, signature, timestamp, nounce, OAuthVersion, token
Please refer to http://googlecodesamples.com/oauth_playground to verify your code and to see the correct header string parameters
I am using the php sdk to access a user's albums and photos in a website.
I am able to login and also able to retrieve all the info about the albums and photos.
However, I am not able to display these photos on the webpage.
When I try the graph API, to get the photo / album like below:
https://graph.facebook.com/131833353530147/picture
I get the following error message:
{
"error": {
"type": "OAuthException",
"message": "An access token is required to request this resource."
}
}
But the same is working in while I try to display my profile pic and I do have a valid access token.
Help on this would be greatly appreciated.
There are 3 things you need.
You need to oAuth with the owner of those photos. (with the 'user_photos' extended permission)
You need the access token (which you get returned in the URL box after the oAuth is done.)
When those are complete you can then access the photos like so https://graph.facebook.com/me?access_token=ACCESS_TOKEN
You can find all of the information in more detail here: http://developers.facebook.com/docs/authentication
Try This url with valid userid and access token:
https://graph.facebook.com/{userid}/photos?limit=20&access_token={access_token}
Login to your Facebook.
Go to http://graph.facebook.com
You will find all your feeds with their corresponding access codes. e.g https://graph.facebook.com/me/home?access_token=2227470867|2.AQAQ6FqN8IW-PUrR.3600.1309471200.0-137977022924629|0sbmdhJN6o9y9J4GDWs8xEygyX8
Enjoy!
To get an access token: facebook Graph API Explorer
You can customize specific access permissions, basic permissions are included by default.
To get the actual access_token, you can also do pro grammatically via the following PHP code:
require 'facebook.php';
$facebook = new Facebook(array(
'appId' => 'YOUR_APP_ID',
'secret' => 'YOUR_APP_SECRET',
));
// Get User ID
$user = $facebook->getUser();
if ($user) {
try {
$user_profile = $facebook->api('/me');
$access_token = $facebook->getAccessToken();
} catch (FacebookApiException $e) {
error_log($e);
$user = null;
}
}
Well, you are having a valid access token to access your information and not others( this is because you got logged in and you have given permission to access your information). But the picture owner has not done the same (logged in + permission ) and so you are getting a violation error.
To obtain permission see this link and decide what kind of informations you want from any user and decide the permissions. Later on embed this in your code. (In the login function call)
Thanks