How can we make it easier for you to develop on top of Wild Apricot?

How to drive the saggerhub api

Hi. It appears that I should be able to use swaggerhub to pull data from my WA database with the API, but I can't figure out how to do this because the code in the code window of swagger is 'read only'. I can see that I have to change it so that it points to my WA site, and although I have an option to enter API key to authenticate, there seems no way to change the site. Help appreciated

1 vote
Sign in
Check!
(thinking…)
Reset
or sign in with
  • facebook
  • google
    Password icon
    Signed in as (Sign out)

    We’ll send you updates on this idea

    Stu shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

    I have to admit, authorization with login/password through swaggerhub stopped working. Authorization with API key (2-nd in a list) still works.

    I can recommend to use one of these options:
    1 POSTMAN – is a great tool to work with API. It is possible to import swagger description.

    2 Use our test tool at API browser. It is a web application located at https://api.wildapricot.org/ui/home/requestoauthtoken

    4 comments

    Sign in
    Check!
    (thinking…)
    Reset
    or sign in with
    • facebook
    • google
      Password icon
      Signed in as (Sign out)
      Submitting...
      • Stu commented  ·   ·  Flag as inappropriate

        Hi Dmitry,
        I did try the OAuth with password method too, but just to be sure I tried again. Firstly, I assume I use pwd/user of an admin of the WA site (I've tried two valid admin details). I added clientID and secret that I know to work already. Continually get a popup asking for user/pwd.

        I then tried with asking for "type: basic auth" which only needs user/pwd and I find out that my admin users are seen as invalid: "auth errorError: Unauthorized, error: invalid_client" so I'm not able to pass the Auth stage with those user details.
        Finally I tried OAuth with clientCredentials, using clientId and secret that I am already able to pull data with in my actual app. I get error: "auth errorError: Bad Request, error: unauthorized_client, description: Client is not authorized to use this grant type."

        What in fact is the 'client' in this case? Is it the WA account? Or is it something to do with how swaggerhub attempts to validate? It seems the problem is in this (unless I totally have overlooked something)

      • AdminDmitry Smirnov (Product Owner, Wild Apricot by Personify) commented  ·   ·  Flag as inappropriate

        Stu,

        Looks like you use "OAuth2, accessCode" mode to access api. This mode is described in swagger specification, but is it not possible to use it from SwaggerHub interface. I recommend to use "OAuth2, password" or "OAuth2, application" mode from SwaggerHub interface.

        I changed order of authorization modes, so that "OAuth2, password" will be the first in the list. Please give it a try and let me know if something goes wrong.

      • Stu commented  ·   ·  Flag as inappropriate

        Thanks Dmitry, this is where I am having the problems - when I use the auth button, it asks for client ID and secret only. I enter valid data for these and select scope, click 'authorise' and a new page opens to:
        https://your_organization.wildapricot.org/sys/login/OAuthLogin?response_type=code&client_id=qvesob9xud&redirect_uri=https%3A%2F%2Fapp.swaggerhub.com%2Foauth2_redirect&scope=auto&state=VHVlIE5vdiAyMCAyMDE4IDE2OjIyOjExIEdNVCsxMzAwIChOZXcgWmVhbGFuZCBEYXlsaWdodCBUaW1lKQ%3D%3D

        Obviously this fails (with "website not found" because it is pointing to "your_organisation" but it is not clear how I can change this. That is why I mentioned that the API was read-only. Is there another way to point this authentication to the actual client site?

      Feedback and Knowledge Base