Forum Discussion

DmitrySmolsky's avatar
DmitrySmolsky
Occasional Visitor
4 years ago

Swagger UI: authorization modal logout/authorize issue

Library version:

swagger-ui-dist#3.32.5

Problem :

It is not possible to authorize again inside same 'Authorization modal' after logout is clicked

Steps to reproduce :

1. Click 'Authorize' button in Swagger UI
2. enter proper client id and client secrets.

3. check necessary scopes

4. click Authorize button below.

5. do proper auth actions in a separate tab.

6. After successful auth process second tab is closed and 'Logout' button appears instead of 'Authorize' (meanwhile auth token endpoint is accessed with proper authorization code)

7. click 'Logout' button (it should be disappear and 'Authorize' should appear. Also clientid+clientsecret + checkboxes remain with the same data)
8. click Authorize.

9. do necessary auth actions in separate tab

10. see next error response in 'Authorization modal' : Auth ErrorError, error: invalid_grant, description: Authorization code is invalid or expired.
Investigation results:
1. oauth2-redirect.html endpoint sends proper authorization code back to main tab.
2. however authActions.authorizeRequest will receive auth code from first authentication try (steps 1-5)

3. It seems redux state is not properly updated during recieving callback from oauth2-redirect.html

4. issue is reproducible on local environment as well as in swagger hub.