account linking fails
Yahoo-Mike opened this issue · comments
Describe the bug
Alexa skill returns bad request (400) when attempting to link account.
To Reproduce
- start jellyfin_alexa_skill
- in Alexa app, attempt to link Jellyfin Player skill to account.
Expected behavior
Expect to see jellyfin login screen in a browser. Instead, "Bad Request (400)" error is displayed.
Versions
- Are you using the Docker image or the Python package?: docker (locally built image)
- jellyfin_alexa_skill: 0.2.1
Additional context
Issue is caused by VALID_ALEXA_REDIRECT_URLS_REGEX not recognising alexa.amazon.co.jp as valid.
alexa.amazon.co.jp is valid: see Account Linking Schemas: Redirect URLs
I think Amazon directs me to their Japanese site, because I'm in Australia.
Suggested solution
The following fixed the problem for me. In config.py:
VALID_ALEXA_REDIRECT_URLS_REGEX = re.compile(
"https://((alexa)|(layla)|(pitangui))\.amazon(\.com|\.co\.jp)/spa/skill/account-linking-status\.html\?vendorId=.+"
)
...and yes there are other regex solutions, but I think this solution is the easiest to read.
I can send this as a pull request, if you prefer.
Thanks for your detailed bug report and suggestion for a customized new regex expression. You are right, the current implemented regex does not cover all valid base domains. I will revise the current regex expression again to cover all valid base domains. The fix will be included in the upcoming version 0.2.2
.