Open
Description
Steps to reproduce:
- Setup an endpoint to use as an
auth_url
and have the auth_url require authentication. Return aTokenRequest
via the endpoint withauth.create_token_request
- Setup an AblyRealtime instance to use
auth_url
andauth_headers
in its client options
Expected Result:
The authorization header is used to authenticate the client to the auth_url
and the subsequent request from the client to get a token from the request token endpoint is successful.
As per the spec item TO3j8 and Ably docs the headers should be used in requests to the auth_url which implies that they shouldn't be sent in the token request to Ably.
Including an authorization header in authHeaders
in ably-js for this scenario works
Actual result:
The request is rejected by realtime and the client goes to the disconnected state
ConnectionManager.on_error_from_authorize(): err = 40144 401 Unexpected error decoding Ably token or JWT; the token is not valid
ConnectionManager.on_error_from_authorize: Client configured authentication provider request failed
ConnectionManager.notify_state(): new state: ConnectionState.DISCONNECTED
Workarounds:
- Return a JWT or Ably token to the client which wont require a request to the request token endpoint
- Use
auth_callback
instead ofauth_url