Once the Authentication has been successful, you can send requests to the OAuth2 Protected Server using the Public ID Token stored as a cookie.
The OAuth2 Provider Server Component, has several methods to send HTTP Requests: GET, POST, DELETE...
You can pass the Token as a parameter or pass the RequestInfo class if you are using the Indy Server components.
void OnCommandGet(TIdContext *AContext, TIdHTTPRequestInfo *ARequestInfo, TIdHTTPResponseInfo *AResponseInfo)
{
if (ARequestInfo->Document == "/private"
{
// return OAuth2 profile data
AResponseInfo->ContentText = OAuth2Provider->Get(ARequestInfo, "https://graph.microsoft.com/v1.0/me");
AResponseInfo->ContentType = "application/json";
AResponseInfo->ResponseNo = 200;
}
else
{
AResponseInfo->ResponseNo = 404;
}
}