(window.webpackJsonp=window.webpackJsonp||[]).push([[8],{136:function(e,n,t){"use strict";t.r(n),t.d(n,"frontMatter",(function(){returni})),t.d(n,"metadata",(function(){returns})),t.d(n,"rightToc",(function(){returnp})),t.d(n,"default",(function(){returnc}));vara=t(2),r=t(9),o=(t(0),t(188)),i={id:"5_to_6",title:"5.x.x to 6.x.x"},s={id:"5_to_6",title:"5.x.x to 6.x.x",description:"SpotifyAPI.Web",source:"@site/docs/5_to_6.md",permalink:"/SpotifyAPI-NET/docs/next/5_to_6",editUrl:"https://github.com/JohnnyCrazy/SpotifyAPI-NET/edit/master/SpotifyAPI.Docs/docs/5_to_6.md",version:"next",lastUpdatedBy:"dependabot[bot]",lastUpdatedAt:1605518005,sidebar:"docs",previous:{title:"UWP",permalink:"/SpotifyAPI-NET/docs/next/example_uwp"}},p=[{value:"SpotifyAPI.Web",id:"spotifyapiweb",children:[{value:"Initialization",id:"initialization",children:[]},{value:"Proxy",id:"proxy",children:[]},{value:"Calling API Endpoints",id:"calling-api-endpoints",children:[]},{value:"Error/Header Handling",id:"errorheader-handling",children:[]}]},{value:"SpotifyAPI.Web.Auth",id:"spotifyapiwebauth",children:[{value:"Authorization Code Auth",id:"authorization-code-auth",children:[]}]}],l={rightToc:p};functionc(e){varn=e.components,t=Object(r.a)(e,["components"]);returnObject(o.b)("wrapper",Object(a.a)({},l,t,{components:n,mdxType:"MDXLayout"}),Object(o.b)("h2",{id:"spotifyapiweb"},"SpotifyAPI.Web"),Object(o.b)("h3",{id:"initialization"},"Initialization"),Object(o.b)("p",null,"In ",Object(o.b)("inlineCode",{parentName:"p"},"5.x"),", a new ",Object(o.b)("inlineCode",{parentName:"p"},"SpotifyWebAPI")," instance could be created without supplying necessary values, since they were implemented as properties. With ",Object(o.b)("inlineCode",{parentName:"p"},"6.x"),", necessary values have to be given in the constructor and ",Object(o.b)("inlineCode",{parentName:"p"},"SpotifyWebAPI")," has been renamed to ",Object(o.b)("inlineCode",{parentName:"p"},"SpotifyClient"),". Also, ",Object(o.b)("inlineCode",{parentName:"p"},"SpotifyClientConfig")," has been introduced to give a better configuration experience, including retry handlers, automatic authenticators and proxy configurations."),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-csharp"}),'// OLD\nvar spotify = new SpotifyWebAPI { AccessToken = "YourAccessToken" };\nvar spotify = new SpotifyWebAPI(ProxyConfig); // No access token - invalid\n\n// NEW\nvar spotify = new SpotifyClient("YourAccessToken");\n\nvar config = SpotifyClientConfig\n .CreateDefault()\n .WithToken("YourAccessToken");\nvar spotify = new SpotifyClient(config);\n\nvar config = SpotifyClientConfig\n .CreateDefault()\n .WithAuthenticator(new ClientCredentialsAuthenticator(CLIENT_ID, CLIENT_SECRET)); // takes care of access tokens\nvar spotify = new SpotifyClient(config);\n')),Object(o.b)("p",null,"For some performance guides, have a look at the ",Object(o.b)("a",Object(a.a)({parentName:"p"},{href:"/SpotifyAPI-NET/docs/next/configuration"}),"Configuration Guide")),Object(o.b)("h3",{id:"proxy"},"Proxy"),Object(o.b)("p",null,"In ",Object(o.b)("inlineCode",{parentName:"p"},"5.x"),", the proxy configuration could be passed to the ",Object(o.b)("inlineCode",{parentName:"p"},"SpotifyWebAPI")," constructor. In ",Object(o.b)("inlineCode",{parentName:"p"},"6.x"),", they're part of the HTTP Client. The built-in http client supports proxies out of the box:"),Object(o.b)("pre",null,Object(o.b)("code",Object(a.a)({parentName:"pre"},{className:"language-csharp"}),'var httpClient = new NetHttpClient(new ProxyConfig("localhost", 8080)\n{\n User = "",\n Password = "",\n SkipSSLCheck = false,\n});\nvar config = SpotifyClientConfig\n .CreateDefault()\n .WithHTTPClient(httpClient);\n\nvar spotify = new SpotifyClient(config);\n')),Object(o.b)("h3",{id:"calling-api-endpoints"},"Calling API Endpoints"),Object(o.b)("p",null,"In ",Object(o.b)("inlineCode",{parentName:"p"},"5.x"),",therewasonebiginstancetosupportallAPIendpoints.Parameterstotheseendpointswerepasseddirectlyasmethodparameters.Opt