Set up the sdk-suggest-token.js script for the callback page

Enable one of the sdk-suggest-token.js script versions on the page that will accept an OAuth token:

<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

"Origin" of the page with a login button or widget to which a postMessage with a token is sent. The parameter value must always be filled in and can't contain the * character.

extraData

Extra data sent to the page with a login button. Must be a valid JSON object.

Return value

Doesn't return anything.

Example of usage on an HTML page

Use the following code to set up a callback 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>