

def auth_sub_string_from_url(url, scopes_param_prefix='auth_sub_scopes'):
    "Finds the token string (and scopes) after the browser is redirected.\n\n  After the Google Accounts AuthSub pages redirect the user's broswer back to\n  the web application (using the 'next' URL from the request) the web app must\n  extract the token from the current page's URL. The token is provided as a\n  URL parameter named 'token' and if generate_auth_sub_url was used to create\n  the request, the token's valid scopes are included in a URL parameter whose\n  name is specified in scopes_param_prefix.\n\n  Args:\n    url: atom.url.Url or str representing the current URL. The token value\n         and valid scopes should be included as URL parameters.\n    scopes_param_prefix: str (optional) The URL parameter key which maps to\n                         the list of valid scopes for the token.\n\n  Returns:\n    A tuple containing the token value as a string, and a tuple of scopes\n    (as atom.http_core.Uri objects) which are URL prefixes under which this\n    token grants permission to read and write user data.\n    (token_string, (scope_uri, scope_uri, scope_uri, ...))\n    If no scopes were included in the URL, the second value in the tuple is\n    None. If there was no token param in the url, the tuple returned is\n    (None, None)\n  "
    if isinstance(url, (str, unicode)):
        url = atom.http_core.Uri.parse_uri(url)
    if ('token' not in url.query):
        return (None, None)
    token = url.query['token']
    scopes = None
    if (scopes_param_prefix in url.query):
        scopes = tuple(token.query[scopes_param_prefix].split(' '))
    return (token, scopes)

dataset/ETHPy150Open acil-bwh/SlicerCIP/Scripted/attic/PicasaSnap/gdata/gauth.py auth_sub_string_from_url/VarMisuse@92/621 `url`->`token`