Skip to content

Instantly share code, notes, and snippets.

@tomayac
Last active December 18, 2022 07:22
Show Gist options
  • Select an option

  • Save tomayac/ebe078ab867a1ef91d017b450ac63936 to your computer and use it in GitHub Desktop.

Select an option

Save tomayac/ebe078ab867a1ef91d017b450ac63936 to your computer and use it in GitHub Desktop.
Snippet repository

There are many code snippets which can be quickly used to show/demo stuff in Chrome for demos or pitches, or just debugging, QA and testing. This is a collection of such snippets with some instructions Snippets can be saved to Chrome and run via one click again!

How to use snippets in Chrome

  • Open Command Menu in DevTools
  • Apple-Shift-P
  • Pick "Create new snippet"
  • Copy & paste code from this repository

Later on run snippet by:

  • Open Command menu again
  • Run snippet via ! operator (For SW snippets select SW context in JS console)
/*
Simulate OpenYolo Signup
Inject library
Steal [client ID](https://developers.google.com/identity/one-tap/web/get-started#get_your_google_api_client_id)
from publisher site (trigger google login, then copy from URL of popup)
Then use this snippet to trigger auto-sign-up popup:
*/
var elem = document.createElement('script');
elem.src = 'https://smartlock.google.com/client';
document.head.appendChild(elem);
const hintPromise = googleyolo.hint({
supportedAuthMethods: ['https://accounts.google.com'],
supportedIdTokenProviders: [
{
uri: 'https://accounts.google.com',
clientId: 'YOUR_GOOGLE_CLIENT_ID'
}
]
});
/*
Simulate OpenYolo Signin
Inject library
Steal [client ID](https://developers.google.com/identity/one-tap/web/get-started#get_your_google_api_client_id)
from publisher site (trigger google login, then copy from URL of popup)
Then use this snippet to trigger auto-sign-up popup (make sure you had logged in before):
*/
var elem = document.createElement('script');
elem.src = 'https://smartlock.google.com/client';
document.head.appendChild(elem);
const retrievePromise = googleyolo.retrieve({
supportedAuthMethods: [
'https://accounts.google.com',
'googleyolo://id-and-password'
],
supportedIdTokenProviders: [
{
uri: 'https://accounts.google.com',
clientId: 'YOUR_GOOGLE_CLIENT_ID'
}
]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment