Use the OAuth client API together with the HTTP/REST client API as shown in the
image.
Context
The image gives you an overview of how the OAuth 2.0 client is used together with the
HTTP/REST client in your ABAP program. It sets an OAuth 2.0 token and makes the HTTP
or REST client send the token back to the program and receive it again. The
following image displays the process.
Procedure
- Create an instance of the OAuth 2.0 client type IF_OAUTH2_CLIENT.
- Create an instance of the HTTP client type IF_HTTP_CLIENT.
Now, the OAuth 2.0 client instance is used to set the access token in
the HTTP client.
- To trigger the access token, the application program calls the SET_TOKEN method
in the OAuth 2.0 client instance and sends the HTTP client instance as a
parameter.
- (a and b) After the access token was handed over to the HTTP client as
described in step 3, use the HTTP client to access OAuth 2.0 protected
resources. Multiple resources can be accessed after setting the access token if
they are covered by the OAuth 2.0 scope assigned to the access token.