Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
react-google-picker-hook
Advanced tools
Google Drive API hook for React compatible with the newest Google auth API
react-google-picker-hook
package# yarn
yarn add react-google-picker-hook
## optional
yarn add --dev @types/google.picker
# npm
npm install react-google-picker-hook --save
## optional
npm install @types/google.picker --save-dev
import { useGooglePicker } from 'react-google-picker-hook';
const [openPicker] = useGooglePicker(
(data: GoogleDrivePickerData, token: string) => {
console.log({ data, token });
if (data?.action === GOOGLE_ACTION.PICKED) {
// Handle file pick
}
},
{
googleAppId: 'googleAppId',
googleAuthClientId: 'googleAuthClientId',
googleAppKey: 'googleAppKey',
},
);
// ...
return <button onClick={openPicker}>Upload!</button>;
There are two separate error callback which can be used for error detection.
const [openPicker] = useGooglePicker(
// ... base callback
{
onAuthFailed: (response: TokenResponse) => {
console.log(response.error_description || response.details);
// handle auth error
},
tokenClientConfig: {
error_callback: ({ message, stack, type }: ErrorCallback) => {
console.log({ message, stack, type });
// handle client error
},
},
},
);
tokenClientConfig
is spread to Google's initTokenClient
customPickerConfig
is used to override the minimal default config used for pickerconst [openPicker] = useGooglePicker(
// ... base callback
{
customPickerConfig: {
// custom picker config
},
tokenClientConfig: {
/* custom config for initTokenClient */
},
},
);
appendCustomPickerConfig
appendCustomViewConfig
Both used to extend the builder pattern of DocsView
and PickerBuilder
const [openPicker] = useGooglePicker(
// ... base callback
{
appendCustomViewConfig: (view) => {
// extend by calling any of the inner setters
return view;
},
appendCustomPickerConfig: (picker) => picker.setSize(300, 300),
},
);
FAQs
Google Drive API hook for React
The npm package react-google-picker-hook receives a total of 13 weekly downloads. As such, react-google-picker-hook popularity was classified as not popular.
We found that react-google-picker-hook demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.