Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receiving unauthorized_client error trying to list all skills #187

Closed
reddit-at-work opened this issue Mar 5, 2021 · 3 comments
Closed
Assignees
Labels
bug Something isn't working documentation

Comments

@reddit-at-work
Copy link

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report  
[ ] Performance issue
[ ] Feature request
[ ] Documentation issue or request
[x ] Other... Please describe: trouble with authentication, receiving unauthorized_client error

I've setup everything as outlined in the guide: a user profile, used ask-cli to generate tokens and replaced the refresh_token with the one I receive

Someone did raise the issue before #174 , but the issue was closed with no resolution

from ask_smapi_sdk import StandardSmapiClientBuilder
smapi_client_builder = StandardSmapiClientBuilder(client_id=client_id, client_secret=client_secret, refresh_token=response['refresh_token'])
smapi_client = smapi_client_builder.client()
try:
    result = smapi_client.list_skills_for_vendor_v1(vendor_id=vendor_id, full_response=True)
    print("==========================================")
    print(result.headers)
    print(result.body)
    print("==========================================")
except Exception as e:
    print(e.body if hasattr(e, 'body') else e)

Expected Behavior

List of skills

Current Behavior

{'error_description': 'Not authorized for requested operation',
'error_type': 'unauthorized_client'}

Your Environment

  • ask-smapi-sdk: 1.0.0
  • Operating System: Windows 10
  • Python: 3.6
  • ask-cli: 1.7.8 and 2.x.x

Python version info

  • Python version used for development: 3.6
@Shreyas-vgr
Copy link
Contributor

Hi @reddit-at-work, thanks for raising the issue.
It seems to be an issue with LWA(Login With Amazon) service where SkillManagementServiceClient is unable to retrieve the access_token from the refresh_token being passed onto the builder.

Let me contact the respective service team owners and fix the issue, will update the ticket once I get a resolution.
Sorry for the inconvenience caused.

@Shreyas-vgr Shreyas-vgr self-assigned this Mar 12, 2021
@Shreyas-vgr Shreyas-vgr added the bug Something isn't working label Mar 12, 2021
@Shreyas-vgr
Copy link
Contributor

Shreyas-vgr commented Mar 12, 2021

Hi @reddit-at-work,
Can you try regenerating tokens using ASK-CLI v2 with arguments shown below
ask util generate-lwa-tokens --clientId <YOUR_CLIENT_ID> --client-confirmation <YOUR_CLIENT_SECRET> and then provide the output refresh_token generated to the StandardSmapiClientBuilder ?

I believe executing ask util generate-lwa-tokens without any argument picks up the CLI's client_id and client_secret by default which might be causing the above error you've raised.

@reddit-at-work
Copy link
Author

Hi @Shreyas-vgr, that solved the issue. Thank you very much! Although I'd to use client-id, client-confirmation in place of clientId and client-secret.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation
Projects
None yet
Development

No branches or pull requests

2 participants