How to call api ( sharepoint 2019 FBA )

Mohammad Qasim 576 Reputation points
2022-01-21T12:49:57.913+00:00

Greetings,
I am using sharepoint 2019 on prem

With FBA.

I have designed custom login page to login

Solution Required :

I have to call api ,below is url

Https://fortiauth.abc.com.pk/v1/auth/

How can i call this api,just let me know thw code

Thanks

Microsoft 365 and Office SharePoint Server Development
{count} votes

2 answers

Sort by: Most helpful
  1. sadomovalex 3,636 Reputation points
    2022-01-26T15:55:02.943+00:00

    according to attached screenshot SSL certificate is invalid for mentioned API. Is it self signed? If yes then you may add this line of code:

    #if DEBUG
    ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
    #endif
    

    NOTE: you should NOT use this code in prod because it will avoid errors with real certificate which should not be avoided (that's why I added #if DEBUG here - this code will work only with Debug configuration).


  2. RaytheonXie_MSFT 40,471 Reputation points Microsoft External Staff
    2022-01-31T08:05:54.597+00:00

    Hi @Mohammad Qasim ,
    Per my research, I will agree with sadomovalex's opinion. I have found a simliary case with your issue
    https://stackoverflow.com/questions/11222759/error-c-sharp-the-underlying-connection-was-closed-could-not-establish-trust-r


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.