Steps to reproduce:
- Setup an endpoint to use as an
auth_url and have the auth_url require authentication. Return a TokenRequest via the endpoint with auth.create_token_request
- Setup an AblyRealtime instance to use
auth_url and auth_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 of auth_url
┆Issue is synchronized with this Jira Task by Unito
Steps to reproduce:
auth_urland have the auth_url require authentication. Return aTokenRequestvia the endpoint withauth.create_token_requestauth_urlandauth_headersin its client optionsExpected Result:
The authorization header is used to authenticate the client to the
auth_urland 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
authHeadersin ably-js for this scenario worksActual result:
The request is rejected by realtime and the client goes to the disconnected state
Workarounds:
auth_callbackinstead ofauth_url┆Issue is synchronized with this Jira Task by Unito