def _set_bearer_user_vars_local(token, allowed_client_ids, scopes):
<EOL>result = urlfetch.fetch(<EOL>'<STR_LIT>' % (_TOKENINFO_URL, urllib.parse.urlencode({'<STR_LIT>': token})))<EOL>if result.status_code != <NUM_LIT:200>:<EOL><INDENT>try:<EOL><INDENT>error_description = json.loads(result.content)['<STR_LIT>']<EOL><DEDENT>except (ValueError, KeyError):<EOL><INDENT>error_description = '<STR_LIT>'<EOL><DEDENT>_logger.error('<STR_LIT>',<EOL>result.status_code, error_description)<EOL>return<EOL><DEDENT>token_info = json.loads(result.content)<EOL>if '<STR_LIT:email>' not in token_info:<EOL><INDENT>_logger.warning('<STR_LIT>')<EOL>return<EOL><DEDENT>if token_info.get('<STR_LIT>') != '<STR_LIT:true>':<EOL><INDENT>_logger.warning('<STR_LIT>')<EOL>return<EOL><DEDENT>client_id = token_info.get('<STR_LIT>')<EOL>if (list(allowed_client_ids) != SKIP_CLIENT_ID_CHECK and<EOL>client_id not in allowed_client_ids):<EOL><INDENT>_logger.warning('<STR_LIT>', client_id)<EOL>return<EOL><DEDENT>_, sufficient_scopes = _process_scopes(scopes)<EOL>authorized_scopes = token_info.get('<STR_LIT>', '<STR_LIT>').split('<STR_LIT:U+0020>')<EOL>if not _are_scopes_sufficient(authorized_scopes, sufficient_scopes):<EOL><INDENT>_logger.warning('<STR_LIT>')<EOL>return<EOL><DEDENT>os.environ[_ENV_AUTH_EMAIL] = token_info['<STR_LIT:email>']<EOL>os.environ[_ENV_AUTH_DOMAIN] = '<STR_LIT>'<EOL>_logger.debug('<STR_LIT>')<EOL>
Validate the oauth bearer token on the dev server.

    Since the functions in the oauth module return only example results in local
    development, this hits the tokeninfo endpoint and attempts to validate the
    token.  If it's valid, we'll set _ENV_AUTH_EMAIL and _ENV_AUTH_DOMAIN so we
    can get the user from the token.

    Args:
      token: String with the oauth token to validate.
      allowed_client_ids: List of client IDs that are acceptable.
      scopes: List of acceptable scopes.