title: What should I use as Cognito's UserContextData => EncodedData?
body: <p>In all AWS Cognito SDKs in most functions you can pass an <code>UserContextData</code> parameter to feed Cognito's Advanced Security feature:  </p>
  
  <pre><code>$result = $client-&gt;forgotPassword([
    'AnalyticsMetadata' =&gt; [
      'AnalyticsEndpointId' =&gt; '&lt;string&gt;',
    ],
    'ClientId' =&gt; '&lt;string&gt;', // REQUIRED
    'SecretHash' =&gt; '&lt;string&gt;',
    'UserContextData' =&gt; [  // &lt;=================== THIS
      'EncodedData' =&gt; '&lt;string&gt;',
    ],
    'Username' =&gt; '&lt;string&gt;', // REQUIRED
  ]);  
  </code></pre>
  
  <p>This field expects some <code>EncodedData</code>.  </p>
  
  <p><strong>What should I put in <code>UserContextData</code> and how do I "encode" it?</strong>  </p>
  
  <p>When using an <code>Admin*</code> function like <code>AdminInitiateAuth</code> I can send unencoded fingerprinting data through <code>ContextData</code>:  </p>
  
  <pre><code>$result = $client-&gt;adminInitiateAuth([
      [...]
      'ContextData' =&gt; [
          'EncodedData' =&gt; '&lt;string&gt;',
          'HttpHeaders' =&gt; [ // REQUIRED
              [
                  'headerName' =&gt; '&lt;string&gt;',
                  'headerValue' =&gt; '&lt;string&gt;',
              ],
              // ...
          ],
          'IpAddress' =&gt; '&lt;string&gt;', // REQUIRED
          'ServerName' =&gt; '&lt;string&gt;', // REQUIRED
          'ServerPath' =&gt; '&lt;string&gt;', // REQUIRED
      ],
      [...]
  ]);
  </code></pre>
  
  <p>The <a href="https://docs.aws.amazon.com/aws-sdk-php/v3/api/api-cognito-idp-2016-04-18.html#shape-usercontextdatatype" rel="noreferrer">documentation</a> does not help:<br>
  <a href="https://i.stack.imgur.com/UL2Sb.png" rel="noreferrer"><img src="https://i.stack.imgur.com/UL2Sb.png" alt="enter image description here"></a></p>