解決Swagger刷新后不能保持登錄問題


https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/785

https://www.it1352.com/1700234.html

https://www.e-learn.cn/topic/3416881

https://mac-blog.org.ua/dotnet-core-swashbuckle-3-bearer-auth/

var configObject = JSON.parse('%(ConfigObject)');
            configObject.responseInterceptor = function (rep) {
                if (rep.ok && rep.url.indexOf('/api/Authorization/SignIn') > -1) {
                    window.sessionStorage.setItem("HoaSwaggerToken", rep.obj.accessToken);
                }
            }
            configObject.onComplete = function () {
                var token = window.sessionStorage.getItem("HoaSwaggerToken");
                if (token) {
                    ui.preauthorizeApiKey("Bearer", token);
                }
            }


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM