I'm trying to determine whether the current viewer of my website is currently following my twitter account. If not I want to display a box in the bottom right which asks the user to follow me.
How do I check whether the user is following me or not?
I have looked at https://dev.twitter.com/docs/api/1/get/followers/ids which says to use screen_name or user_id. however I do not know how to get this from someone who is viewing my site.
Any help is appreciated.
Thanks
To check if the current user is following you or not, first you need to know his twitter id or screen name. Then you can check if he is following you or not.
check this documentation: https://dev.twitter.com/docs/api/1.1/get/friendships/lookup
If the current user follows you then there will be "followed_by" in connections array in sample response they given in the above link.
I wish this helps you
Note : you are checking in API version 1, it has been deprecated long ago, please upgrade to API version 1.1
Related
I'm trying to use the Google Calendar API in one of my projects. To do so, I need to set up OAuth access in the Google API console.
But when creating the consent-form (which is required to use OAuth), I get a meaningless error message:
The translation is as follows:
A problem occured. Please check your data and try again . If you have
not given any details, the problem may solve itself . In this case, we
recommend that you wait and try again later.
I have set the E-Mail address and project name. The optional fields were left blank.
So far I have not been able to solve the problem. I tried to wait for hours/days. I tried three different browsers. I also tried to contact Google support. All without success.
After days of trying, this is the solution:
Create another Google account
Using your old account, add the new account as an owner to your Google API project in the console
Log in with your new user account and accept the invitation
Create the OAuth consent form with the new user account
I have no idea WHY this worked, but it did.
I need to use Twitter Oauth to login my windows phone app,
What i need exactly is
1)when the user click twitter log in button from my app, i need to show the twitter llog in page in a browser,
2)when he enters his credentials and accept the app, then i should get the user information like, name, gender, bday, what ever i can take.
That,s it, then i can close the browser and make my app active.
I just need to make the user to log in via twitter.
I referred lot of examples, that are all quit confusing and doing all the stuffs in twiiter.
I tried this example
and got this error
'TweetSharp.TwitterService' does not contain a definition fError 2 'TweetSharp.TwitterService' does not contain a definition for 'GetAccessToken' and no extension method 'GetAccessToken' accepting a first argument of type 'TweetSharp.TwitterService' could be found (are you missing a using directive or an assembly reference?)
and i tried enter link description here
failed on that too.
Can anybody help me to do the authentication via twitter for my app.
Thank you.
I tried this example and got success, I contacted the person who have posted that example and got help from him to solve the issues raised from this example.
Actually this Example works fine for twitter integration,
What you have to do is
1)Register your app in twitter, here the link for app registration,
log in and register your app.
2)Make sure you have given the Call Back URL(i forget to give that, and that makes me face lot of issues)
3)Note down the Consumer Key, Consumer Secret and Call back url(we need specify this 3 in our code)
4)Go to Settings, and set your app access to Read and Write
5)down load the above link and change the Consumer Key, Consumer Secret and Call back url as per your app, and then run the example, it will work fine.
Thank you.
If you just want to authenticate using Twitter and don't want to post anything, perhaps you can try Azure Mobile Service Authentication. You can find more information here: mobile services authentication
I'm currently building a test and trying to get a google+ user location. I'm testing on myself and have set my position to public.
I was originally planning to use Google Latitude, however, since Google is deprecating this API in a few days, my only option is to use the Google+ API.
The parameter currentLocation was added a few months ago
I'm therefore trying to get it. But could not manage to do it.
I've tested on my own server using the PHP API and then the JS API with Oauth2.0, but this damn parameter is never sent back. I can get any other parameter but definitely not that one.
Then I've tested in the google+ explorer, but same thing here, nothing came out
Does anyone have already encounter a similar issue ?
I have a few idea where it could come from :
Does Oauth2.0 does not let me access this information (I've tried
any possible data-scope)
Is there just a bug on this functionality ?
Is it restricted to verified users ?
Or maybe it's just not possible ?
Thanks !
Access to location data is restricted to users who have granted you access to their location data at the time that the OAuth token was generated.
You have to specifically request access to location data in the scope parameter.
What I think is that r.placesLived would only give his location but the location of the user nor the location of the exact machine. It could be remembered that you need to have the address. However, it needs to look for another token for verifying a user's exact location. Going into it might only need more of a tracker and not only a location.
This is an old one but still valid question. Even field "currentLocation" is listed as valid reponse People object field, there´s no way to access field´s data.
Was reported as issue in G+ repository but there is no answer so far.
If you are still trying to get user´s current location try the following snippet, not sure if this is the best option but it works :):
Note: "r" holds the client.request() response data (API call)
r.placesLived.forEach(function(l) {
if (l.primary)
console.log(l.value);
});
Hope this helps.
Cheers.
Problem : I am facing difficulties in getting user's birthday from api calls and I am new to OAuth.
Steps followed : (Have followed all steps required for implementing login with google+)
1. Created an app.
2. Obtained app_id and secret_key.
3. Did not make use of SDK, implemented the process without SDK in php.
4. Obtained "CODE" by calling accounts[dot]google[dot]com/o/oauth2/auth?
5. Using the code from the URL parameters requested for access token by HTTPS POST method to https://accounts.google.com/o/oauth2/token, using CURL
6. When accessing the login page, user is asked for permissions to access the information such as email, profile, DOB etc., but I am not able to find a way to get that date of birth
7. I have tried access www[dot]googleapis[dot]com/plus/v1/people/User_ID?key={THE_API_KEY} . Still no luck
Please guide or suggest me on how to get the DOB. Also let me know if there is any other information I missed to share.
Thanks in advance.
Cheers!
Farhan
Well Well Ofcourse.. It has to be a security thing from google.
I got to know after I did a part of unit testing with different scenarios and missed out on a simple thing that google only responds with the b'day information if the user has allowed to in his profile settings.
all if the birth year is hidden, it will throw 0000 as year in the response of the HTTPS Post method.
If I am wrong in any of the information provided, Please do correct me.
Cheers!
Farhan.
I would like to get the user's country info as specified in the documentation [1]. I tried using the Google API explorer and the samples, and still cant get the country info. I even tried updated the test account's profile info.
[1] https://developers.google.com/accounts/docs/OAuth2Login
[2] https://developers.google.com/apis-explorer/#p/oauth2/v2/oauth2.userinfo.get?_h=15&
The field editor in the Google API does not list parameter for country either. Is there some undocumented way that anyone knows about. Assuming that the user would provide complete access for their profile to the client app.
I am afraid that the documentation is inconsistent.
In the description of the userinfo.profile scope we do list "country" as part of the basic profile information being authorized by the user. However, and as described later in the documentation, locale information is provided instead.
The documentation will be updated shortly in order to avoid further confusion.