FNC Cloud Pack Overview Demo

Hi,

I tried using this demo to try connecting to Microsoft Outlook. I have all the correct credentials and the OAuth screen came up, I was able to login and the message "Application Successfully Authorized" was displayed but then the following message was displayed:

image

Can you please provide any information on why this may be happening?

It may be very clever to put all the demos into one application but it is a nightmare trying to debug it.

Thanks,

Ken

If I comment out the following in TMSFNCCloudMicrosoft.pas it works fine:

procedure InitializeRetrieveAccessTokenRequest(const ACloudBase: TTMSFNCCloudOAuth);
begin
  ACloudBase.Request.Clear;
  ACloudBase.Request.Name := 'RETRIEVE ACCESS TOKEN';
  {$IFNDEF WEBLIB}
  ACloudBase.Request.Host := 'https://login.microsoftonline.com';
  ACloudBase.Request.Path := '/common/oauth2/v2.0/token';

  ACloudBase.Request.PostData := 'client_id=' + TTMSFNCUtils.URLEncode(ACloudBase.Authentication.ClientID)
//  + '&client_secret=' + TTMSFNCUtils.URLEncode(ACloudBase.Authentication.Secret)
  + '&redirect_uri=' + TTMSFNCUtils.URLEncode(ACloudBase.Authentication.CallBackURL)
  + '&access_type=offline'
  + '&approval_prompt=force'
  + '&code=' + TTMSFNCUtils.URLEncode(ACloudBase.Authentication.AuthenticationToken)
  + '&grant_type=authorization_code';

  ACloudBase.Request.Method := rmPOST;
  {$ENDIF}
end;

procedure InitializeRetrieveRefreshTokenRequest(const ACloudBase: TTMSFNCCloudOAuth);
begin
  ACloudBase.Request.Clear;
  ACloudBase.Request.Name := 'REFRESH ACCESS TOKEN';
  {$IFNDEF WEBLIB}
  ACloudBase.Request.Host := 'https://login.microsoftonline.com';
  ACloudBase.Request.Path := '/common/oauth2/v2.0/token';
  ACloudBase.Request.AddHeader('Content-Type', 'application/x-www-form-urlencoded');

  ACloudBase.Request.PostData := 'client_id=' + TTMSFNCUtils.URLEncode(ACloudBase.Authentication.ClientID)
//  + '&client_secret=' + TTMSFNCUtils.URLEncode(ACloudBase.Authentication.Secret)
  + '&code=' + TTMSFNCUtils.URLEncode(ACloudBase.Authentication.AuthenticationToken)
  + '&redirect_uri=' + TTMSFNCUtils.URLEncode(ACloudBase.Authentication.CallBackURL)
  + '&refresh_token=' + TTMSFNCUtils.URLEncode(ACloudBase.Authentication.AccessTokenRefresh)
  + '&grant_type=refresh_token';

  ACloudBase.Request.Method := rmPOST;
  {$ENDIF}
end;

Can you please make sure to select "Web" in the "Redirect URI" dropdown when you created the app in the Microsoft console?
image

Full instructions can be found here: TMS Software | TMS Cloud / Mapping Controls

Thanks, but it doesn't give me that option:

The console interface has changed recently, please make sure to select "Web" as platform instead of "Mobile and desktop applications".

image

Thanks Bart, I'll give that a try!

I am now getting this error:

image

Hi,

I'm not sure what is causing this error.
We are not aware of any issues with connecting to Outlook Mail or Outlook Calendar via the FNC Cloud Pack overview demo.

  • Which version of the demo are you running? (FMX, VCL or WEB)
  • Can you please make sure your client ID and secret have been configured correctly as indicated here?
    TMS Software | TMS Cloud / Mapping Controls
  • Have you tried creating a new client ID and secret?

I am using the VCL demo. Everything seems to be configured ok. Creating a new clientID/Secret makes no difference.

I have retested the access to Outlook Mail & Outlook Calendar in the VCL version of the TMS FNC Cloud Pack overview demo and haven't been able to reproduce an issue.

Can you post screenshots of your app configuration (client ID & secret + callback URI) in the Azure console?
If the screenshots contain sensitive information, please use a private message to provide screenshots.

If I switch back to mobile/desktop and comment out the lines I originally posted it works fine. Is your app setup as follows:

Yes our app setup is similar.
How is your Web Redirect URI configured?

This might be related to a difference in how the Azure framework handles recently created new Apps compared to older existing Apps.
We are currently investigating this issue and will report back as soon as possible.

Thanks Bart. When configuring authentication as web or desktop the redirect URL is http://localhost:8000.

After further investigation we haven't been able to reproduce an issue when following the steps to create a Microsoft Azure App configuration as provided here:

Can you please try to create a new app exactly as described in the link above?

If the problem persists, please provide an exact description of the problem with screenshots of the error and your app configuration so I can further investigate this.