Open C6silver opened 10 years ago
I've made some discoveries here that are relevant. I went ahead and coded the authentication manually without using the SDK. Interestingly when it came time to get the access token I also received a JSON error exactly as the SDK did. I examined the output which showed nothing obviously wrong. I next decided to do this in two steps by first bringing the results from the URL into a string and then I read that string via JSON and it worked. I don't know why that should have worked rather than using JSON to start. Obviously without changing the code in the SDK this does not solve the problem here and I am unsure if others are running into the same thing.
For clarity here is what I wound up writing:
token = urllib2.urlopen(tokenLink).read()
token2 = json.loads(token)
I'm still a student and I'm getting the idea of the API, but I believe it uses a 2-way handshake for the authentication ( your server > API server, API server > your server ). So, the API server needs to send a message to your server, for that, your server should be online, not running locally. If you pass "http://127.0.0.1:14080/linkedincallback" as a parameter for the return URL the API server will try to redirect the call to itself and you will never get a response. Am I right?
Michelcyc, no that isn't how it works. The browser making the login request is handed back the callback URI from the Oauth provider (LinkedIn, FaceBook, Twitter, etc.) The service itself is not calling back. The address I used in my post was indeed internal as it was for development purposes. Testing the process internally works just fine as of course I have access to that IP. In production it would be a public address.
I am able to get almost to the end of the flow but I receive a: "ValueError: No JSON object could be decoded" based on the get_access_token() call.
The code:
class LinkedInLogin(webapp2.RequestHandler):
class LinkedInCallBack(webapp2.RequestHandler):