DNN Forums

Ask questions about your website to get help learning DNN and help resolve issues.

DNN v9.12.00 Web API

Sort:
You are not authorized to post a reply.
Page 2 of 2 << < 12





Veteran Member





    Posted By Martin on 7/26/2023 10:02 AM

    One thing that is very strange: My ISP told me that he can authorize successfully to my API with the FTP-Credentials (which have nothing to do with the users and roles inside DNN)

    Uh, that's weird. 

    Anyhow, did you try in a restored staging website?  Are you able to modify the endpoint at all?  If yes, I'd recommend removing all security from the endpoint and testing again.  Then, begin by slowly increasing the security.  For example, the next test might simply require `DnnAuthorize`, then use a built-in security role, then finally use your custom security role.  

     






    New Around Here





      Yes, I tried anything unfortunately without success on a staging site (and with the same Test-Api on other DNN-Sites hosted by the same ISP).

      I can reach the endpoint with no problem by adding the Attribute [AllowAnonymous]. But as soon as I use an authorization attribute like [DnnAuthorize] or [DnnAuthorize(StaticRoles = "Administrators")], the error 401 - Unauthorized: Access is denied due to invalid credentials appears.






      Veteran Member





        Are you sure you're successfully passing through the ServicesFramework and passing it in the header of your requests? That's what this sounds like. 🤔 






        New Around Here





          I think I'm doing everything correct because on my local PC everything works fine...

          What exactly do you mean by 'passing it in the header of your requests'?

          I have to mention that I have to access the Endpoint from outside: Endpoint is hosted on www.aaaaaaa.com and I have to do a request to this endpoint from www.bbbbbbb.com






          New Around Here





            Would it be better to switch to JWT?






            New Around Here





              Maybe 2 screenshots from Postman can help you find what I am making wrong:

              Postman_1

               

              Postman_2






              Veteran Member





                You shouldn't necessarily need to switch to JWT for this, but it's an option.  

                If you're using Angular, here's an example of adding the headers:  

                https://github.com/Upendo...Scripts/common.js#L8

                If you're using jQuery or something like it, here's an example of that: 

                https://github.com/WillSt...Order.ascx#L25C1-L68






                New Around Here





                  Do you know if there exists a list with all core endpoints? For example something like DesktopModules/Internalservices/API/Authentication/login?





                  Veteran Member





                    Posted By Martin on 8/3/2023 4:49 AM
                    Do you know if there exists a list with all core endpoints? For example something like DesktopModules/Internalservices/API/Authentication/login?

                    I'm not sure if such a list exists or not...  🤔 

                    However, there is a section in the DNN documentation that might help you with that. 

                     

                    You are not authorized to post a reply.
                    Page 2 of 2 << < 12

                    These Forums are dedicated to the discussion of DNN Platform.

                    For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

                    1. If you have (suspected) security issues, please DO NOT post them in the forums but instead follow the official DNN security policy
                    2. No Advertising. This includes the promotion of commercial and non-commercial products or services which are not directly related to DNN.
                    3. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
                    4. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
                    5. No Flaming or Trolling.
                    6. No Profanity, Racism, or Prejudice.
                    7. Site Moderators have the final word on approving / removing a thread or post or comment.
                    8. English language posting only, please.

                    Would you like to help us?

                    Awesome! Simply post in the forums using the link below and we'll get you started.

                    Get Involved