Function OAuthSession.authorizeRequest

Authorize an HTTP request using this session's token.

void authorizeRequest (
  scope vibe.http.client.HTTPClientRequest req
) @safe;

void authorizeRequest (
  scope vibe.http.client.HTTPClientRequest req
) @safe const;

When implementing a REST interface client for a service using OAuth, you may want to set vibe.web.rest.RestInterfaceClient.requestFilter to a delegate to this method, so authorization will be handled automatically.

This implementation only supports, and blindly assumes, the 'bearer' token type. Subclasses should override this if support for other token types is required.

If this instance is mutable and the access token has expired and a refresh token is available, a new access token will be requested automatically by a call to refresh.

Parameters

NameDescription
req The request to be authorized

Throws

OAuthException if this session doesn't have any access token, or the access token has expired and cannot be refreshed.