LinkedIn API OAuth issue - python

This is my first time using the LinkedIn API. I am using Python.
I am exactly following the steps listed here: https://developer.linkedin.com/documents/getting-oauth-token-python
Everything goes well until I try to get the PIN for the access token. I type into my browser: "https://www.linkedin.com/uas/oauth/authorize?oauth_token=" + oauth_token , and then I get the error "We were unable to find the authorization token."
I also tried to download the full code linked at the top of the page, but that goes to a "page not found".
Anyone have any insight as to why I can't get the access token PIN? Thank you.

I apologize for not seeing this sooner. The code on that page has been restored and you can download it now without issue.
https://developer.linkedin.com/documents/getting-oauth-token-python
If it's still not working, please let us know (I'll check back here, or you can post in our forums). I use essentially that exact code whenever I test our API so it should work.

Related

Access Yahoo weather using Oauth

Totally lost here. I have a weather station that I developed on Python for a Raspberry PI. Very nice and useful (I am a biker). But it recently stopped working!
I was using weather.com and Yahoo APIs. weather.com is not free since 01/15/2020, and Yahoo now requests an Oauth access that I don't have. I have signed up and I have my AppID, ClientID and SecretCode... But I don't have a clue about what to do with it. After reading a lot, I think that I have to get a Token, but I don't know how to get it and what to do with it (store it on disk???). In addition to that, it seems that it needs to be refreshed from time to time.
Everything I found is on C++, java or php (that I don't understand); and it is very distinct from one source to another, so I am not sure which one to use.
If someone could help me to understand what to do, where to look or an example, I would really appreciate that.
To the moment, I tried this which "promisses" to manage oauth connections, with no success:
from yahoo_oauth import OAuth1
oauth = OAuth1(None, None, from_file='oauth1.json')
if not oauth.token_is_valid():
oauth.refresh_access_token()
# Example
response = oauth.session.post(url, data=body)
Nevertheless, I think that this is just to refresh the token, but as I said before, I don't know how to get it and what to do whit it.
All you actually need is here, with python example :)
Documentation yahoo.
Here are the stepss for setup: Setup steps
What is going on with the token? Yahoo needs some verification that it is you who make request - so you need to add the Authorization token to you request. That's all :)
Ask here, if you had more questions :)

Website google oauth needed

Probably this was already answered somewhere, but my google-fu can't get proper keywords for this.
Ok so, I need to get a file from my site which is like foo.bar/foobar/file.ext . That file is always accessible but if you aren't google-authenticated on the site you get a blank file.
How can I get proper authentication with python?
Sorry if this isn't very clear but it's my first time here... Thanks in advance for help
First install the Python SDK here.
Then I would start reading about OAuth here.
They have different examples depending on your use case. (e.g. If you are authenticating a user from their browser, versus from server to server)

Error in Tutorial to sign-in to Google account using Python

This is a direct follow up to the information provided in this question:
Enter website by logging in Google Account using Python
One of the suggestions I found, was to follow this google tutorial for python:
quick start for python
And I am having some problems because of the heavy changes in the interface.
My biggest problem is in Step 1 - 3b. Aparently I have to paste these values:
http://localhost:4567
http://mysite.example.com
https://mysite.example.com
in some place, but I have no idea where.
So I simply continued with the tutorial, and launched the application on my localhost on port 4567.
Now, the application launched fine, but when I click the login button I get an error:
Error:invalid_client
no registered origin
Request details:
scope=https://www.googleapis.com/auth/plus.login https://www.googleapis.com/auth/plus.moments.write https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/plus.profile.agerange.read https://www.googleapis.com/auth/plus.profile.language.read https://www.googleapis.com/auth/plus.circles.members.read
redirect_uri=postmessage
state=303270744|0.3942616991
origin=http://localhost:4567
display=page
request_visible_actions=http://schemas.google.com/AddActivity
cookie_policy_enforce=false
response_type=code token id_token gsession
access_type=offline
cookie_policy=single_host_origin
proxy=oauth2relay678941372
client_id=933139289991-iigr70l8u8rbjecm6vrrs3bj4fck0ptu.apps.googleusercontent.com
authuser=0
Am I getting this error because the tutorial I am following is very outdated, or because I didn't do Step 1 - 3b correctly?
How can I fix this? All I want is to log in into a google account, if there is an easier way to do it with python, feel free to let me know :S
The problem is that the tutorial tells you how to set up the project using the Google API Console (see the link in Step 1, the first item), but Google is slowly moving people to use the Cloud Console instead. So if you follow that link, you get redirected to the new Cloud Console. If you want to get back to the API Console (so you can follow the rest of the steps listed there), you should see a message at the top of that page that says:
If you click on the "Go back" link, you'll be back at the API Console and you can follow the rest of the steps listed in the tutorial.
Steps 1-3b are important, since they are how you setup a Project, indicate what API resources it has available to it, and indicate how you will be accessing the project. It also will give you the Client ID and Secret that your python program will use when connecting to Google's servers.

How can I access SoundCloud-Stream URLs in Python?

Some time ago I wrote a little tool for a friend of mine. I retrieved all stream-links (like this) from a soundlist and downloaded all those with a small python script.
Since begin of March, soundcloud must have changed something, and now my cronjob recieves 401 Unauthorized errors. I've read through the soundcloud API, but that whole Access Token does not really fit my needs.
Has anyone of you an idea of easily dealing with this problem? Thanks.
As Makoto said, 401 seems like you have lost priviledges to access through your OAuth token so I would double check to make sure your app is still available and that your tokens are correct. You can check on the Your Apps Page.
Also, I noticed that your url seemed a bit different than what the SC api shows. Once you resolve to get a proper track id, the convention for a stream url is:
http://api.soundcloud.com/tracks/{id}/stream
This can be found in their track documentation.
Read the documentation here. You have to add your client_id parameter to the stream url and then you will be redirected to the stream link (mp3).

Why isn't posting a status update to Facebook working?

I had a working Python integration to Facebook, using the Graph API and the https://graph.facebook.com/<<id>>/feed URL, for about a month.
And then all of a sudden a few days ago, I started getting this back whenever I tried to post a status update:
{"error":{"type":"OAuthException","message":"(#200) The user hasn't authorized the application to perform this action"}}
I'm requesting (and getting) the publish_stream permission, and I can do other things like get friends, pages, etc.
Any ideas? There's a link here http://forum.developers.facebook.net/viewtopic.php?id=73912 that shows there are others dealing with this.
Thanks!
So I now have my app working again. I ended up using the JavaScript API from Facebook, using that to login the user, set the cookie, and then I use the Python SDK from Facebook to make the actual status update. It works.
How this is different from what I was doing (my own Python code for doing the same stuff) is beyond me. The token returned by both the JavaScript and my own Python code are identical.
So it works, but I'm not sure how.

Categories

Resources