danielgtaylor / restish

Restish is a CLI for interacting with REST-ish HTTP APIs with some nice features built-in
https://rest.sh/
MIT License
717 stars 69 forks source link

redirect_mismatch v0.20.0 #249

Open tormodmacleod opened 3 months ago

tormodmacleod commented 3 months ago

hello,

i'm new to restish. i installed it and configured it the same as a colleague

$ cat ~/.config/restish/apis.json
{
  "$schema": "https://rest.sh/schemas/apis.json",
  "cp": {
    "base": "https://some_aws_api_gateway_url.eu-west-1.amazonaws.com/dev",
    "profiles": {
      "default": {
        "auth": {
          "name": "oauth-authorization-code",
          "params": {
            "authorize_url": "https://some_aws_cognito_endpoint.eu-west-1.amazoncognito.com/oauth2/authorize",
            "client_id": "some_client_id",
            "scopes": "openid email profile cp/api",
            "token_url": "https://some_aws_cognito_endpoint..eu-west-1.amazoncognito.com/oauth2/token"
          }
        }
      }
    },
    "tls": {}
  }
}

his set up worked, mine didn't. it looks like it's an issue with version 0.20.0 as he was running version 0.19.0

$ ./restishv19 --version && rm ~/.cache/restish/cache.json 
restishv19 version 0.19.0
$ ./restishv19 cp

the above works fine but

$ ./restishv20 --version && rm ~/.cache/restish/cache.json 
restishv20 version 0.20.0
$ ./restishv20 cp

produces the following error in the browser

image

DominicBortmes commented 3 months ago

which OS do you two use? to looks like it may be an duplicate of the issue I filed recently #248. btw: amazon cognito showing such an error typically indicates that your requests mismatch with what cognito’s oidc idp server expects. in my the referenced issue above, i found missing http query parameter (when restish fired the authorize requested) also yielded a similar error page as you’re facing.

tormodmacleod commented 3 months ago

@DominicBortmes we use Fedora. the issue seems to be related to the trailing / on the redirect url. the default was changed in v0.20.0. i've created https://github.com/danielgtaylor/restish/pull/250 but in the meantime the workaround for me is just to add

            "redirect_url": "http://localhost:8484/"

to my config