You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Before all thanks for making swagger free, the tool look very nice.
I have installed swagger-ui-dist and I have created the following page in my React application:
importReactfrom'react';import{SwaggerUIBundle,SwaggerUIStandalonePreset}from"swagger-ui-dist"import'swagger-ui-dist/swagger-ui.css';// import 'swagger-ui-dist/oauth2-redirect.html';import{oAuthClient}from"../../../config/index";importmessagesfrom'./messages';exportdefaultclassSwaggerUIPageextendsReact.PureComponent{state={ui: null,}componentDidMount(){this.initializeUi();}initializeUi(){const{ redirectUri }=oAuthClient;constui=SwaggerUIBundle({url: `${redirectUri}/v2/api-docs`,dom_id: '#swagger-ui',oauth2RedirectUrl: redirectUri,presets: [SwaggerUIBundle.presets.apis,SwaggerUIStandalonePreset],plugins: [SwaggerUIBundle.plugins.DownloadUrl,SwaggerUIBundle.plugins.AuthActions,SwaggerUIBundle.plugins.AuthIndex,SwaggerUIBundle.plugins.AuthReducers,SwaggerUIBundle.plugins.AuthSelectors,SwaggerUIBundle.plugins.AuthSpecWrapActions,],});this.setState({ ui },this.initializeOAuth);}initializeOAuth(){const{ clientId, clientSecret, accessTokenUri, redirectUri }=oAuthClient;console.log(oAuthClient);console.log(SwaggerUIBundle.plugins)console.log(SwaggerUIBundle.presets)// Method can be called in any place after calling constructor SwaggerUIBundleconstoauth=this.state.ui.initOAuth({
clientId,
clientSecret,realm: 'api',tokenUrl: accessTokenUri,oauth2RedirectUrl: redirectUri,redirectUri: 'http://localhost:8080/oauth/token',appName: 'backend-test',scopeSeparator: ' ',additionalQueryStringParams: {test: 'hello'},useBasicAuthenticationWithAccessCodeGrant: true,
...oAuthClient,scopeList: [],});console.log(oauth);// console.log(window.opener.swaggerUIRedirectOauth2);// oauth2.callback({auth: oauth2.auth, token: json, isValid: true});}render(){return(<divid="swagger-ui"/>);}}
I've also tried to add the content of oauth2-redirect.html in my react scope.
Because I don't know what to do. I don't see any authentication request going anywhere, I don't find much in the documentation and I see a lot of written code for plugins.
I am using the authorization code grant flow, and I already have the jwt in my app, is there a way to quickly provide it to swagger client ?
The text was updated successfully, but these errors were encountered:
@shockey this issue concerned my impossibility to complete the installation with OAuth2. #3953 is an issue about Unit test failing for latest react and enzyme version. We can track both in #3953 for sure.
Before all thanks for making swagger free, the tool look very nice.
I have installed
swagger-ui-dist
and I have created the following page in my React application:I've also tried to add the content of
oauth2-redirect.html
in my react scope.Because I don't know what to do. I don't see any authentication request going anywhere, I don't find much in the documentation and I see a lot of written code for plugins.
I am using the authorization code grant flow, and I already have the jwt in my app, is there a way to quickly provide it to swagger client ?
The text was updated successfully, but these errors were encountered: