1from oauthlib.oauth2.rfc6749.errors import OAuth2Error 
    2 
    3""" 
    4oauthlib.oauth2.rfc8628.errors 
    5~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    6 
    7Error used both by OAuth2 clients and providers to represent the spec 
    8defined error responses specific to the the device grant 
    9""" 
    10 
    11 
    12class AuthorizationPendingError(OAuth2Error): 
    13    """ 
    14    For the device authorization grant; 
    15      The authorization request is still pending as the end user hasn't 
    16      yet completed the user-interaction steps (Section 3.3).  The 
    17      client SHOULD repeat the access token request to the token 
    18      endpoint (a process known as polling).  Before each new request, 
    19      the client MUST wait at least the number of seconds specified by 
    20      the "interval" parameter of the device authorization response, 
    21      or 5 seconds if none was provided, and respect any 
    22      increase in the polling interval required by the "slow_down" 
    23      error. 
    24    """ 
    25 
    26    error = "authorization_pending" 
    27 
    28 
    29class SlowDownError(OAuth2Error): 
    30    """ 
    31    A variant of "authorization_pending", the authorization request is 
    32    still pending and polling should continue, but the interval MUST 
    33    be increased by 5 seconds for this and all subsequent requests. 
    34    """ 
    35 
    36    error = "slow_down" 
    37 
    38 
    39class ExpiredTokenError(OAuth2Error): 
    40    """ 
    41    The "device_code" has expired, and the device authorization 
    42    session has concluded.  The client MAY commence a new device 
    43    authorization request but SHOULD wait for user interaction before 
    44    restarting to avoid unnecessary polling. 
    45    """ 
    46 
    47    error = "expired_token" 
    48 
    49 
    50class AccessDenied(OAuth2Error): 
    51    """ 
    52    The authorization request was denied. 
    53    """ 
    54 
    55    error = "access_denied"