Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
google-picker-component
Advanced tools
Simple react wrapper for Google Picker API
npm install google-picker-component
<GooglePicker clientId={'your-client-id'}
developerKey={'your-developer-key'}
scope={['https://www.googleapis.com/auth/drive.readonly']}
onChange={data => console.log('on change:', data)}
onAuthFailed={data => console.log('on auth failed:', data)}
multiselect={true}
navHidden={true}
authImmediate={false}
mimeTypes={['image/png', 'image/jpeg', 'image/jpg']}
query={'a query string like .txt or fileName'}
viewId={'DOCS'}>
<MyCustomButton />
</GooglePicker>
You might want to get the Oauth token in order to use it later, for example
in order to download the selected file.
You can do so by using onAuthenticate
:
<GooglePicker clientId={'your-client-id'}
developerKey={'your-developer-key'}
scope={['https://www.googleapis.com/auth/drive.readonly']}
onChange={data => console.log('on change:', data)}
onAuthenticate={token => console.log('oauth token:', token)}
onAuthFailed={data => console.log('on auth failed:', data)}
multiselect={true}
navHidden={true}
authImmediate={false}
mimeTypes={['image/png', 'image/jpeg', 'image/jpg']}
viewId={'DOCS'}>
<MyCustomButton />
</GooglePicker>
You can override the default build function by passing your custom function which receives two arguments:
google
: a reference to the window.google object.access_token
: which you will need to pass to setOAuthToken
method.<GooglePicker clientId={CLIENT_ID}
developerKey={DEVELOPER_KEY}
scope={SCOPE}
onChange={data => console.log('on change:', data)}
onAuthFailed={data => console.log('on auth failed:', data)}
multiselect={true}
navHidden={true}
authImmediate={false}
viewId={'FOLDERS'}
createPicker={ (google, oauthToken) => {
const googleViewId = google.picker.ViewId.FOLDERS;
const docsView = new google.picker.DocsView(googleViewId)
.setIncludeFolders(true)
.setMimeTypes('application/vnd.google-apps.folder')
.setSelectFolderEnabled(true);
const picker = new window.google.picker.PickerBuilder()
.addView(docsView)
.setOAuthToken(oauthToken)
.setDeveloperKey(DEVELOPER_KEY)
.setCallback(()=>{
console.log('Custom picker is ready!');
});
picker.build().setVisible(true);
}}
>
<span>Click</span>
<div className="google"></div>
</GooglePicker>
This example creates a picker which shows folders and you can select folders.
npm install
npm start
open http://localhost:8080
FAQs
Simple react wrapper for google picker API
The npm package google-picker-component receives a total of 0 weekly downloads. As such, google-picker-component popularity was classified as not popular.
We found that google-picker-component 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.