mirror of
				https://github.com/usememos/memos.git
				synced 2025-10-25 13:56:27 +08:00 
			
		
		
		
	chore: update cookie attrs
This commit is contained in:
		
							parent
							
								
									25efc33b24
								
							
						
					
					
						commit
						8f15e8773a
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		|  | @ -165,7 +165,7 @@ func (s *APIV2Service) doSignIn(ctx context.Context, user *store.User, expireTim | ||||||
| 		cookieExpires = time.Now().AddDate(100, 0, 0) | 		cookieExpires = time.Now().AddDate(100, 0, 0) | ||||||
| 	} | 	} | ||||||
| 	if err := grpc.SetHeader(ctx, metadata.New(map[string]string{ | 	if err := grpc.SetHeader(ctx, metadata.New(map[string]string{ | ||||||
| 		"Set-Cookie": fmt.Sprintf("%s=%s; Path=/; Expires=%s; HttpOnly; SameSite=None; Secure", auth.AccessTokenCookieName, accessToken, cookieExpires.Format(time.RFC1123)), | 		"Set-Cookie": fmt.Sprintf("%s=%s; Path=/; Expires=%s; HttpOnly; SameSite=None", auth.AccessTokenCookieName, accessToken, cookieExpires.Format(time.RFC1123)), | ||||||
| 	})); err != nil { | 	})); err != nil { | ||||||
| 		return status.Errorf(codes.Internal, "failed to set grpc header, error: %v", err) | 		return status.Errorf(codes.Internal, "failed to set grpc header, error: %v", err) | ||||||
| 	} | 	} | ||||||
|  | @ -231,7 +231,7 @@ func (*APIV2Service) SignOut(ctx context.Context, _ *apiv2pb.SignOutRequest) (*a | ||||||
| 
 | 
 | ||||||
| func clearAccessTokenCookie(ctx context.Context) error { | func clearAccessTokenCookie(ctx context.Context) error { | ||||||
| 	if err := grpc.SetHeader(ctx, metadata.New(map[string]string{ | 	if err := grpc.SetHeader(ctx, metadata.New(map[string]string{ | ||||||
| 		"Set-Cookie": fmt.Sprintf("%s=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; HttpOnly; SameSite=None; Secure", auth.AccessTokenCookieName), | 		"Set-Cookie": fmt.Sprintf("%s=; Path=/; Expires=Thu, 01 Jan 1970 00:00:00 GMT; HttpOnly; SameSite=None", auth.AccessTokenCookieName), | ||||||
| 	})); err != nil { | 	})); err != nil { | ||||||
| 		return errors.Wrap(err, "failed to set grpc header") | 		return errors.Wrap(err, "failed to set grpc header") | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue