(window.webpackJsonp=window.webpackJsonp||[]).push([[18],{150:function(e,t,r){"use strict";r.r(t),r.d(t,"frontMatter",(function(){returnc})),r.d(t,"metadata",(function(){returns})),r.d(t,"rightToc",(function(){returnp})),r.d(t,"default",(function(){returnl}));varn=r(2),o=r(9),a=(r(0),r(186)),i=r(188),c={id:"example_asp",title:"ASP.NET"},s={id:"example_asp",title:"ASP.NET",description:"Description",source:"@site/docs/example_asp.md",permalink:"/SpotifyAPI-NET/docs/next/example_asp",editUrl:"https://github.com/JohnnyCrazy/SpotifyAPI-NET/edit/master/SpotifyAPI.Docs/docs/example_asp.md",version:"next",lastUpdatedBy:"Jonas Dellinger",lastUpdatedAt:1592253583,sidebar:"docs",previous:{title:"Showcase",permalink:"/SpotifyAPI-NET/docs/next/showcase"},next:{title:"Blazor WASM",permalink:"/SpotifyAPI-NET/docs/next/example_blazor_wasm"}},p=[{value:"Description",id:"description",children:[]},{value:"Run it",id:"run-it",children:[]}],u={rightToc:p};functionl(e){vart=e.components,r=Object(o.a)(e,["components"]);returnObject(a.b)("wrapper",Object(n.a)({},u,r,{components:t,mdxType:"MDXLayout"}),Object(a.b)("h2",{id:"description"},"Description"),Object(a.b)("p",null,"This example is based on ASP .NET Core. It uses ",Object(a.b)("inlineCode",{parentName:"p"},"Authorization Code")," under the hood with the help of ",Object(a.b)("a",Object(n.a)({parentName:"p"},{href:"https://www.nuget.org/packages/AspNet.Security.OAuth.Spotify/"}),Object(a.b)("inlineCode",{parentName:"a"},"AspNet.Security.OAuth.Spotify")),". It stores the access token in the current user session (cookie-based) and allows to refresh tokens when they expire. Two pages are implemented:"),Object(a.b)("ul",null,Object(a.b)("li",{parentName:"ul"},"Home shows your current playlists via pagination"),Object(a.b)("li",{parentName:"ul"},"Profile shows your current profile information")),Object(a.b)("img",{alt:"ASP Example - Home",src:Object(i.a)("img/asp_example_home.png")}),Object(a.b)("img",{alt:"ASP Example - Profile",src:Object(i.a)("img/asp_example_profile.png")}),Object(a.b)("h2",{id:"run-it"},"Run it"),Object(a.b)("p",null,"Before running it, make sure you created an app in your ",Object(a.b)("a",Object(n.a)({parentName:"p"},{href:"https://developer.spotify.com/dashboard/"}),"spotify dashboard")," and ",Object(a.b)("inlineCode",{parentName:"p"},"https://localhost:5001")," is a redirect uri of it."),Object(a.b)("pre",null,Object(a.b)("code",Object(n.a)({parentName:"pre"},{className:"language-bash"}),"# Assumes linux and current working directory is the cloned repository\ncd SpotifyAPI.Web.Examples/Example.ASP\ndotnet restore\n\nSPOTIFY_CLIENT_ID=YourClientId SPOTIFY_CLIENT_SECRET=YourClientSecret dotnet run\n\n# Visit https://localhost:5001\n")))}l.isMDXComponent=!0},186:function(e,t,r){"use strict";r.d(t,"a",(function(){returnl})),r.d(t,"b",(function(){returnb}));varn=r(0),o=r.n(n);functiona(e,t,r){returntine?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}functioni(e,t){varr=Object.keys(e);if(Object.getOwnPropertySymbols){varn=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){returnObject.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}returnr}functionc(e){for(vart=1;t<arguments.length;t++){varr=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}returne}functions(e,t){if(null==e)return{};varr,n,o=function(e,t){if(null==e)return{};varr,n,o={},a=Object.keys(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||(o[r]=e[r]);returno}(e,t);if(Object.getOwnPropertySymbols){vara=Object.getOwnPropertySymbols(e);for(n=0;n<a.length;n++)r=a[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}returno}varp=o.a.createContext({}),u=function(e){vart=o.a.useContext(p),r=t;returne&&(r="function"==typeofe?e(t):c({},t,{},e)),r},l=function(e){