(window.webpackJsonp=window.webpackJsonp||[]).push([[16],{148:function(e,t,n){"use strict";n.r(t),n.d(t,"frontMatter",(function(){returns})),n.d(t,"metadata",(function(){returnc})),n.d(t,"rightToc",(function(){returnp})),n.d(t,"default",(function(){returnu}));varr=n(2),a=n(9),i=(n(0),n(188)),o=n(190),s={id:"implicit_grant",title:"Implicit Grant"},c={id:"implicit_grant",title:"Implicit Grant",description:"Implicit grant flow is for clients that are implemented entirely using JavaScript and running in the resource owner\u2019s browser. You do not need any server-side code to use it. Rate limits for requests are improved but there is no refresh token provided. This flow is described in RFC-6749.",source:"@site/docs/implicit_grant.md",permalink:"/SpotifyAPI-NET/docs/next/implicit_grant",editUrl:"https://github.com/JohnnyCrazy/SpotifyAPI-NET/edit/master/SpotifyAPI.Docs/docs/implicit_grant.md",version:"next",lastUpdatedBy:"dependabot[bot]",lastUpdatedAt:1611009091,sidebar:"docs",previous:{title:"Client Credentials",permalink:"/SpotifyAPI-NET/docs/next/client_credentials"},next:{title:"Authorization Code",permalink:"/SpotifyAPI-NET/docs/next/authorization_code"}},p=[{value:"Existing Web-Server",id:"existing-web-server",children:[]},{value:"Using custom Protocols",id:"using-custom-protocols",children:[]}],l={rightToc:p};functionu(e){vart=e.components,n=Object(a.a)(e,["components"]);returnObject(i.b)("wrapper",Object(r.a)({},l,n,{components:t,mdxType:"MDXLayout"}),Object(i.b)("blockquote",null,Object(i.b)("p",{parentName:"blockquote"},"Implicit grant flow is for clients that are implemented entirely using JavaScript and running in the resource owner\u2019s browser. You do not need any server-side code to use it. Rate limits for requests are improved but there is no refresh token provided. This flow is described in ",Object(i.b)("a",Object(r.a)({parentName:"p"},{href:"http://tools.ietf.org/html/rfc6749#section-4.2"}),"RFC-6749"),".")),Object(i.b)("p",null,"This flow is useful for getting a user access token for a short timespan."),Object(i.b)("h2",{id:"existing-web-server"},"Existing Web-Server"),Object(i.b)("p",null,"If you are already in control of a Web-Server (like ",Object(i.b)("inlineCode",{parentName:"p"},"ASP.NET"),"), you can start the flow by generating a login uri:"),Object(i.b)("pre",null,Object(i.b)("code",Object(r.a)({parentName:"pre"},{className:"language-csharp"}),'// Make sure "http://localhost:5000" is in your applications redirect URIs!\nvar loginRequest = new LoginRequest(\n new Uri("http://localhost:5000"),\n "ClientId",\n LoginRequest.ResponseType.Token\n)\n{\n Scope = new[] { Scopes.PlaylistReadPrivate, Scopes.PlaylistReadCollaborative }\n};\nvar uri = loginRequest.ToUri();\n// Redirect user to uri via your favorite web-server\n')),Object(i.b)("p",null,"When the user is redirected to the generated uri, they will have to login with their Spotify account and confirm that your application wants to access their user data. Once confirmed, they will be redirected to ",Object(i.b)("inlineCode",{parentName:"p"},"http://localhost:5000")," and the fragment identifier (",Object(i.b)("inlineCode",{parentName:"p"},"#")," part of URI) will contain an access token."),Object(i.b)("div",{className:"admonition admonition-warning alert alert--danger"},Object(i.b)("div",Object(r.a)({parentName:"div"},{className:"admonition-heading"}),Object(i.b)("h5",{parentName:"div"},Object(i.b)("span",Object(r.a)({parentName:"h5"},{className:"admonition-icon"}),Object(i.b)("svg",Object(r.a)({parentName:"span"},{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"16",viewBox:"0 0 12 16"}),Object(i.b)("path",Object(r.a)({parentName:"svg"},{fillRule:"evenodd",d:"M5.05.31c.812.17.413.38-.524.31C3.555.671.986.45.97.98c-1.452.05-1.76.533.537.7-2.2-1.16-2.67-4.52-.3-6.61-.612.03.533.331.942.861.39-.472.3.532.271.67-.02.78-.311.44-1.131.813.42-.594.78-3.424.78-5.560-2.84-2.53-3.22-1.25-5.61-1.52.13-2.031.13-1.892.75.091.08-1.021.8-1.861.33-.67-.41-.66-1.19-.06-1.78C8.185.318.682.455.05.32L5.03.3l.02.0