extensions/amp-access/0.1/signin.js
/**
   * Processes login dialog's result. And if `#code=` hash parameter
   * is specified, will send this authorization code to the viewer to exchange
   * for the access token. This method returns promise that will resolve the
   * exchanged access token.
   *
   * If viewer has not opted-in into signin protocol, this method returns
   * `null`. If source origin has not opted-in into signin protocol via
   * `acceptAccessToken: true` configration option and by returning
   * `#code=` response from the login dialog, this method returns
   * `null`.
   *
   * The viewer is allowed to store the access token, but only when the user
   * explicitly consents to it.
   *
   * @param {!Object<string, string>} query
   * @return {?Promise<?string>}
   */
Processes login dialog's result. And if `#code=` hash parameter
is specified, will send this authorization code to the viewer to exchange
for the access token. This method returns promise that will resolve the
exchanged access token.

If viewer has not opted-in into signin protocol, this method returns
`null`.

The viewer is allowed to store the access token, but only when the user
explicitly consents to it.

@param {!Object} query
@return {?Promise}
Processes login dialog ' s result . And if ` #code = ` hash parameter is specified will send this authorization code to the viewer to exchange for the access token . This method returns promise that will resolve the exchanged access token . If viewer has not opted - in into signin protocol this method returns ` null ` . The viewer is allowed to store the access token but only when the user explicitly consents to it . @param { !Object } query @return { ?Promise }
postLoginResult(query) {
    if (!this.acceptAccessToken_) {
      return null;
    }
    const authorizationCode = query['code'];
    if (!authorizationCode) {
      return null;
    }
    return this.viewer_.sendMessageAwaitResponse('storeAccessToken', dict({
      'origin': this.pubOrigin_,
      'authorizationCode': authorizationCode,
    })).then(resp => {
      const accessToken =  (resp);
      this.updateAccessToken_(accessToken);
      return accessToken;
    }).catch(reason => {
      user().error(TAG, 'Failed to retrieve access token: ', reason);
      return null;
    });
  }
postLoginResult ( query ) { if ( ! this . acceptAccessToken_ ) { return null ; } const authorizationCode = query [ 'code' ] ; if ( ! authorizationCode ) { return null ; } return this . viewer_ . sendMessageAwaitResponse ( 'storeAccessToken' , dict ( { 'origin' : this . pubOrigin_ , 'authorizationCode' : authorizationCode , } ) ) . then ( resp => { const accessToken = ( resp ) ; this . updateAccessToken_ ( accessToken ) ; return accessToken ; } ) . catch ( reason => { user ( ) . error ( TAG , 'Failed to retrieve access token: ' , reason ) ; return null ; } ) ; }
Processes login dialog's result.
Processes login dialog ' s result .
/** @type {?string} */