Skip to content

Unable to use Inspector on Basic Auth'd endpoints #445

@ulidtko

Description

@ulidtko

RPC APIs prevalently require some kind of authentication, often HTTP Basic Auth.

It's currently not even possible to test RPCs and their OpenRPC descriptions:

{
    "jsonrpc": "2.0",
    "id": 0,
    "error": {
        "message": "Window.fetch: http://dummy-user:test-password@localhost/rpc is an url with embedded credentials."
    }
}

Well, yes it is! What's the error?!?

I do understand that it's Window.fetch acting up, and OpenRPC Playground merely provides context. This seems to be a relatively recent issue with browsers: https://medium.com/@lmakarov/say-goodbye-to-urls-with-embedded-credentials-b051f6c7b6a3

Any workarounds? Did I miss the user/password fields in Add transport dialogs?

Removing the dummy-user:test-password@ from the URL just produces NetworkError when attempting to fetch resource. — the RPC call I'm trying to make is never made (i.e. not even a 401 error).

Repro steps

  1. This nginx snippet:
         location /rpc {
             auth_basic "This API required authentication.";
             auth_basic_user_file /tmp/test.htpasswd;
    
             try_files /dev/null =418;
         }
    
  2. printf "dummy-user:$(openssl passwd -apr1 test-password)\n" > /tmp/test.htpasswd
  3. Try to invoke any OpenRPC method, e.g. list_pets (doesn't matter) from the Inspector to http://localhost/rpc

Expected behavior

There is a way to test Basic Auth'd RPC endpoints.

Actual behavior

No working way exists.

Desktop

  • OS: Linux
  • Browser: Firefox 78.0.2
  • Browser: Brave Version 1.9.76 Chromium: 81.0.4044.138

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions