Skip to content
This repository has been archived by the owner on Apr 3, 2021. It is now read-only.

Unhandled exception: Missing param name: "openid.oa2.access_token" (KeyError) #3

Closed
cjemorton opened this issue Mar 7, 2020 · 4 comments
Labels
question Further information is requested

Comments

@cjemorton
Copy link

Trying to get this project working and I've been playing around with it.

Here are the steps I've taken.

  • Install crystal.
  • create a shard.yml file & run shards install. It pulls down the dependencies, and this project.
  • create a test crystal file called run.cr.

require "audible"

client = Audible::Client.new("MY_EMAIL", "MY_PW", locale: "us")
File.write("session.json", client.to_json)

I get a url with an image to enter into the readline. Once I do, I get the following error.

Unhandled exception: Missing param name: "openid.oa2.access_token" (KeyError)
from /usr/share/crystal/src/http/params.cr:163:21 in '[]'
from lib/audible/src/audible.cr:250:25 in 'initialize:locale'
from lib/audible/src/audible.cr:105:5 in 'new:locale'
from run.cr:3:1 in '__crystal_main'
from /usr/share/crystal/src/crystal/main.cr:106:5 in 'main_user_code'
from /usr/share/crystal/src/crystal/main.cr:92:7 in 'main'
from /usr/share/crystal/src/crystal/main.cr:115:3 in 'main'
from __libc_start_main
from _start
from ???

My version of crystal:

Crystal 0.33.0 [612825a53] (2020-02-14)

LLVM: 8.0.0
Default target: x86_64-unknown-linux-gnu

My version of shards:

Shards 0.8.1 [0147a56] (2020-02-14)

My os.

Linux DESKTOP-84RDSE8 4.4.0-18362-Microsoft #476-Microsoft Fri Nov 01 16:53:00 PST 2019 x86_64 GNU/Linux

I am probably missing something simple. If you could nudge me in the right direction I'd sure appreciate it. Thanks for your time.

@omarroth omarroth added the question Further information is requested label Mar 9, 2020
@omarroth
Copy link
Owner

Would you mind running shards update again to see if ddf8737 fixes your issue or provides any additional information? I'm not quite sure what the problem may be, since the code you provided appears to work as expected for my account.

@cjemorton
Copy link
Author

I ran shards update.

Installing audible (0.2.4)

After entering the CAPTCHA, these are the results.

Unhandled exception: Unable to login. Invalid URI: https://www.amazon.com/ap/challenge?ie=UTF8&arb=ff1928a8-5fd2-4178-b25e-c5b4b95abd8c (Exception)
from lib/audible/src/audible.cr:250:25 in 'initialize:locale'
from lib/audible/src/audible.cr:104:5 in 'new:locale'
from run.cr:3:1 in '__crystal_main'
from /usr/share/crystal/src/crystal/main.cr:106:5 in 'main_user_code'
from /usr/share/crystal/src/crystal/main.cr:92:7 in 'main'
from /usr/share/crystal/src/crystal/main.cr:115:3 in 'main'
from __libc_start_main
from _start
from ???

@cjemorton
Copy link
Author

Just ran another test.

This time I spun up a clean instance of Ubuntu on digital ocean, to try and rule out local environment.

I installed Crystal as per: https://crystal-lang.org/install/on_ubuntu/

I uploaded my yml file. & ran shards to pull down the project.

I uploaded the exact file I was using locally.

Exactly this (only with my account and password)

require "audible"

client = Audible::Client.new("MY_EMAIL", "MY_PW", locale: "us")
File.write("session.json", client.to_json)

And I get this exact response.

Unhandled exception: Unable to login. Invalid URI: https://www.amazon.ca/ap/challenge?ie=UTF8&arb=bdea0497-1244-4b99-a1d9-006ff0d44371 (Exception)
from lib/audible/src/audible.cr:250:25 in 'initialize:locale'
from lib/audible/src/audible.cr:104:5 in 'new:locale'
from run.cr:3:1 in '__crystal_main'
from /usr/share/crystal/src/crystal/main.cr:106:5 in 'main_user_code'
from /usr/share/crystal/src/crystal/main.cr:92:7 in 'main'
from /usr/share/crystal/src/crystal/main.cr:115:3 in 'main'
from __libc_start_main
from _start
from ???

So I don't think it's my local environment that's doing it.

I have also tried different locales.

"us", "ca" etc.

same thing.

@cjemorton
Copy link
Author

Ok!

Figured it out...

After your commit [ddf8737] fixed the initial problem.

I stepped back for a couple days to get a clear head... (always helps ...)

When I looked at it again, EUREKA! ... I simply went to the link in the error and proved it was me, by sending a text (or email). Some 2 factor thing. It's not obvious by the error thrown. Anyways, It generated a nice sessions.json file to use.

So far, it's working great.

Thanks for your time on this!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants