nazwr / swaggerhub-doc-portal

Part 2 is currently live.
https://empire-doc-portal.netlify.com/
50 stars 29 forks source link

oauth2 implicit flow #2

Open vtmas opened 5 years ago

vtmas commented 5 years ago

Hi Nathan,

Your "Documentation Portal tutorial" was awesome! :)

I already have a swagger based api, working with oauth2 implict flow. However when wiring it into your api portal i cannot get it work. I am being redirected correctly to api-portal/oauth2-redirect.html#access_token=t&expires_in=3600&state=s&token_type=bearer But its not picked up by the 'ui' as it usually is.

Is this something your portal should be capable of and I am missing something? Or is this something that you are planning to add?

Thank you, Tamas

nazwr commented 5 years ago

Hey Tamas - glad you enjoyed the tutorial! Is the authentication issue related to supporting the 'Try It Out' functionality that is baked into SwaggerUI, or the front end in this repo making a call to the API you have for the JSON definition to render?

vtmas commented 5 years ago

Hi, it's related to the authorize function with oauth2 with the front end with this repo. The way it works with the 'native' swagger ui:

  1. The user clicks authorize, then he is redirected to the authorization server.
  2. Authorization server authorizes him and redirectes to the same host where the original ui is hosted except to the oauth2-redirect.html, not index.html. What oauth2-redirect.html does is it parses out the access token from the url path and stores it, and appends it to the 'Try It Out' curl command, same as with apiKey (which works with your portal aswell ).

What happens with your frontend i think that oauth2-redirect.html is not correctly hosted/integrated to the div. Because the redirect happens correctly except its not parsed.

I am not sure if I managed to answer your question :)