Set up the sdk-suggest-token.js script for the auxiliary page
On the page that will receive the OAuth token, link one of the following sdk-suggest-token.js script versions:
Version with polyfills (recommended)
Basic version
<head>
<script src="https://yastatic.net/s3/passport-sdk/autofill/v1/sdk-suggest-token-with-polyfills-latest.js"></script>
</head>
See also:
<head>
<script src="https://yastatic.net/s3/passport-sdk/autofill/v1/sdk-suggest-token-latest.js"></script>
</head>
Syntax and parameters
YaSendSuggestToken(origin, extraData)
A call example for the login widget or button:
YaSendSuggestToken(
'https://examplesite.com',
{
flag: true
}
)
See also Example of usage on an HTML page
Parameter descriptions:
Parameter |
Description |
|
"Origin" of the page with a login button or widget to which a |
|
Extra data sent to the page with a login button. Must be a valid JSON object. |
Return value
Nothing is returned.
Example of usage on an HTML page
Use the following code to set up an auxiliary page that will receive the token:
<!doctype html>
<html lang="ru">
<head>
<meta charSet="utf-8" />
<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, shrink-to-fit=no, viewport-fit=cover'>
<meta http-equiv='X-UA-Compatible' content='ie=edge'>
<style>
html,
body {
background: #eee;
}
</style>
<script src="https://yastatic.net/s3/passport-sdk/autofill/v1/sdk-suggest-token-with-polyfills-latest.js"></script>
</head>
<body>
<script>
window.onload = function() {
window.YaSendSuggestToken("https://examplesite.com", {
"kek": true
});
};
</script>
</body>
</html>