Skip to content

Environment ASK_REFRESH_TOKEN ignored #409

@DrPsychick

Description

@DrPsychick

I'm submitting a...


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

Expected Behavior

I expect that, ASK_REFRESH_TOKEN, ASK_ACCESS_TOKEN, ASK_VENDOR_ID environment variables, if defined, take precedence over the values in the cli_config file.

Current Behavior

  1. without cli_config it simply crashes
  2. with a cli_config with invalid access_token and refresh_token it correctly displays "Token is invalid/expired."
  3. even when setting the correct environment variables, ask still uses the values from the cli_config file
ASK_DEFAULT_PROFILE=default
ASK_ACCESS_TOKEN="Atza|IwEBIDef..."
ASK_REFRESH_TOKEN="Atzr|IwEBICM..."
ASK_VENDOR_ID="M2C.."

Steps to Reproduce (for bugs)

# set valid credentials via ENV
export ASK_DEFAULT_PROFILE=default
export ASK_ACCESS_TOKEN="Atza|IwEBIDef..."
export ASK_REFRESH_TOKEN="Atzr|IwEBICM..."
export ASK_VENDOR_ID="M2C.."
# edit your `cli_config` and edit `access_token` and `refresh_token` to become invalid

ask dialog --debug --replay mySkill.replay
[...]
Request headers: {"authorization":"Atza|IwEBIPE..." ...
# notice that the token used in the request is NOT the one provided via ENV

Possible Solution

Check why ENV is not working

  • if ENV is given and there is no cli_config file, it should be created
  • if ENV is given, it should always take precedence

Your Environment and Context

  • ask-cli version: 2.24.1
  • Operating System and version: macOS Big Sur (arm64)
  • Node.js version used for development: v16.8.0
  • NPM version used for development: 7.21.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions