userId 값을 사용하여 사용자의 새 세션을 만듭니다. 로그인한 사용자에 관한 자세한 내용은 사용자 및 새 이벤트를 참고하세요.
files.create 메서드를 사용하여 파일 리소스를 만듭니다. 요청에 folderId가 설정된 경우 parents 필드를 folderId 값으로 설정합니다.
요청에 folderResourceKey가 설정된 경우 X-Goog-Drive-Resource-Keys 요청 헤더를 설정합니다. 리소스 키에 관한 자세한 내용은 리소스 키를 사용하여 링크 공유 파일에 액세스를 참고하세요.
state 매개변수는 URL로 인코딩되므로 앱에서 이스케이프 문자를 처리하고 JSON으로 파싱해야 합니다.
사용자 및 새 이벤트
Drive 앱은 모든 '만들기' 이벤트를 잠재적인 로그인으로 처리해야 합니다. 일부 사용자에게는 여러 계정이 있을 수 있으므로 state 매개변수의 사용자 ID가 현재 세션과 일치하지 않을 수 있습니다. state 매개변수의 사용자 ID가 현재 세션과 일치하지 않으면 앱의 현재 세션을 종료하고 요청된 사용자로 로그인합니다.
[null,null,["최종 업데이트: 2025-02-24(UTC)"],[[["When a user creates a new file with your app from Drive UI, your app receives a `state` parameter containing action, folder details, and user ID."],["Your app should verify the `action` is \"create\", create a user session, and use the provided information to create a new file via the Drive API."],["All \"create\" events should be treated as potential sign-ins and handled to accommodate users with multiple accounts, potentially requiring session switching."],["The `state` parameter is URL-encoded and needs to be parsed as JSON by your application for proper data extraction."]]],["When a user selects an app via Drive UI's \"New\" button, Drive redirects to the app's New URL, sending a `state` parameter. The `state` includes `action` (set to \"create\"), `folderId`, `folderResourceKey`, and `userId`. The app must verify the `action`, initiate a new user session based on `userId`, use `files.create` to generate a file resource, and handle `folderId` and `folderResourceKey`. All \"create\" events should be treated as potential sign-ins, with user sessions adjusted accordingly. The `state` parameter is URL-encoded JSON and must be parsed.\n"]]