Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- services.AddSession(s => {
- s.IdleTimeout = TimeSpan.FromHours(1);
- s.Cookie = new CookieBuilder()
- {
- Name = AppInfo.AppName,
- MaxAge = TimeSpan.FromHours(1),
- IsEssential = true,
- HttpOnly = true,
- SecurePolicy = CookieSecurePolicy.SameAsRequest,
- SameSite = SameSiteMode.Strict,
- };
- });
- services.AddAuthentication(o =>
- {
- o.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme; // Default authenticate scheme is cookie
- o.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; // Default sign-in scheme is cookie
- //o.DefaultChallengeScheme = "Spotify"; // Set Spotify as default challenge scheme
- })
- .AddCookie(c =>
- {
- c.Cookie.Name = AppInfo.AppName;
- })
- .AddGoogle(options =>{
- options.ClientId = "";
- options.ClientSecret = "";
- options.SaveTokens = true;
- options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
- options.Scope.Add("https://www.googleapis.com/auth/youtube");
- options.Scope.Add("https://www.googleapis.com/auth/youtube.readonly");
- })
- .AddSpotify("Spotify", options =>{
- options.ClientId = "";
- options.ClientSecret = "";
- options.SaveTokens = true;
- options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
- options.Scope.Add(SpotifyAPI.Web.Scopes.UserReadEmail);
- options.Scope.Add(SpotifyAPI.Web.Scopes.UserReadPrivate);
- options.Scope.Add(SpotifyAPI.Web.Scopes.UserFollowRead);
- options.Scope.Add(SpotifyAPI.Web.Scopes.PlaylistReadPrivate);
- options.CallbackPath = "/signin-spotify";
- });
Advertisement
Add Comment
Please, Sign In to add comment