We’ve developed some resources to help you work effectively from home during COVID-19 Click to learn more

Unable to Logon / Authenticate

Hi,

 

I've finally got round to looking into Apps and Have followed (the very good) intro videos by Tony. Everything was going well and I though it was going to be very easy indeed; However, When I try to create my SoSession, I am getting an error that looks a bit dodgy....

"The Server did not provide a meaningful reply; this might be caused by a contract mismatch, a premature session shutdown or an internal server error."

I can get my superIdToken and it's populated as expected. But I'm stuck at getting my session:

Any Help would be greatly appreciated!

Cheers

Rich

RE: Unable to Logon / Authenticate

Hi Rich!

Well that's a new one! :-/

From the snippet, of which there isn't enough to conclude anything, it looks like you are handling the SAML token. Are you also getting back the JWT as well? Maybe try processing that instead... I guess I could answer a lot more of my own questions about your situation if you provided your APP ID... 

It looks like you are using the AuthHerlper class from github... Are you testing with one of the example apps as well, or something you created? Essentially, how can I reproduce your observation?

Av: Tony Yates 10. jan 2019

RE: Unable to Logon / Authenticate

Hi Tony,

Yes I do have the JWT in the Request, so I will try that now.

Please find below the code I am using:

string samlToken = Request["saml"];

if (!string.IsNullOrWhiteSpace(samlToken))
{
var tokenHandler = new SuperOffice.SuperID.Client.Tokens.SuperIdTokenHandler();
var superIdToken = tokenHandler.ValidateToken(samlToken, SuperOffice.SuperID.Contracts.SystemUser.V1.TokenType.);

using (SuperOffice.SoDatabaseContext.DatabaseContext context = SuperOffice.SoDatabaseContext.EnterDatabaseContext(superIdToken.ContextIdentifier))
{
SuperOffice.Configuration.ConfigFile.WebServices.RemoteBaseURL = superIdToken.NetserverUrl;

using (SuperOffice.SoSession session = SuperOffice.SoSession.Authenticate(superIdToken.Ticket, ""))
{
var principle = session.Principal;
}
}

return View(superIdToken);
}

 

Also, the Login: Response.Redirect("https://sod.superoffice.com/Login/?app_id=3e157d25a407d1489eb9d6be671f2022");

And here is my screen shot of the Debug:

Many Thanks :)

 

Av: Rich Hacker 10. jan 2019

RE: Unable to Logon / Authenticate

Tony,

I've got the same problem using JWT aslo.

Av: Rich Hacker 10. jan 2019

RE: Unable to Logon / Authenticate

Just FYI: I had registered this App a while ago, but the link/keys had expired. The keys were re-generated by Margrethe yesterday. Just in case this could be part of the problem!

 

Av: Rich Hacker 10. jan 2019

RE: Unable to Logon / Authenticate

Hello Rich,

The netserverUrl in your returned superIdToken is the wrong one if you use the SuperOffice Services dll's/Nuget package, it should be something like "https://sod.superoffice.com/Cust25333/remote/services86". (services86/services85/services84)

The url "https://sod.superoffice.com/Cust25333/api" is when you use the web/REST api's.

What netserverUrl is returned is a setting which can be set by Margrethe in the Online OC.

Av: David Hollegien 10. jan 2019

RE: Unable to Logon / Authenticate

It's not part of the problem, I regenerated system user private/public key since the original I sent was deleted from SendSafely without being picked up. 

I do see you have authroized the app on your test tenant in SOD, and that you are redirected to the whitelisted redirect url I posted in the message. If  you want to use another url, then I need to whitelist it here so just sent it back to me in the ticket.

 

 

Av: Margrethe Romnes 10. jan 2019

RE: Unable to Logon / Authenticate

David,

I changed this line:

SuperOffice.Configuration.ConfigFile.WebServices.RemoteBaseURL = superIdToken.NetserverUrl;

To

SuperOffice.Configuration.ConfigFile.WebServices.RemoteBaseURL =  "https://sod.superoffice.com/Cust25333/remote/services86";

And it is working. Thankyou!!!!

In Tony's second video @ 8:30 (https://community.superoffice.com/en/video-center/video-player/how-to-build-your-first-online-app-part-2/), he sets it to the 'superIdToken.NetserverUrl' and it works? I'm slightly confused, I though we should set the RemoteBaseUrl dynamically ?

Many Thanks everyone so far!

Cheers

Rich

 

Av: Rich Hacker 10. jan 2019

RE: Unable to Logon / Authenticate

Hello Rich,

In Tony's second video @ 8:30 (https://community.superoffice.com/en/video-center/video-player/how-to-build-your-first-online-app-part-2/), he sets it to the 'superIdToken.NetserverUrl' and it works? I'm slightly confused, I though we should set the RemoteBaseUrl dynamically ?

Yes normally your code would be correct, but your app needs to be configured to return the correct endpoint (webapi/netserver). This is something that SuperOffice needs to configure for you. (appdev@superoffice.com)

Av: David Hollegien 10. jan 2019

RE: Unable to Logon / Authenticate

In the form where you register the app you may specify which endpoints you want returned, and when only WebApi (RestFUL) was ticked I just enabled that one.

From now on I will also include the latest services endpoint as well.

 

 

 

Av: Margrethe Romnes 10. jan 2019

RE: Unable to Logon / Authenticate

Perfect, thankyou eveyone!

Margrethe, please could I ask you to add check we have both webAPI and Services 84/85 enabled to my application, so I can test?

Many thanks

Rich

 

Av: Rich Hacker 10. jan 2019