code: def auth(self, code="", refresh_token=""):
  
          
  
          if refresh_token:
              try:
                  self.oauth.request_token(grant_type="refresh_token", refresh_token=refresh_token)
                  self.refresh_token = self.oauth.refresh_token
              except HTTPError as e:
  
                  if e.code == 401:
                      raise DeviantartError("Unauthorized: Please check your credentials (client_id and client_secret).")
                  else:
                      raise DeviantartError(e)
          elif self.standard_grant_type == "authorization_code":
              try:
                  self.oauth.request_token(grant_type=self.standard_grant_type, redirect_uri=self.redirect_uri, code=code)
                  self.refresh_token = self.oauth.refresh_token
              except HTTPError as e:
  
                  if e.code == 401:
                      raise DeviantartError("Unauthorized: Please check your credentials (client_id and client_secret).")
                  else:
                      raise DeviantartError(e)
          elif self.standard_grant_type == "client_credentials":
              try:
                  self.oauth.request_token(grant_type=self.standard_grant_type)
              except HTTPError as e:
  
                  if e.code == 401:
                      raise DeviantartError("Unauthorized: Please check your credentials (client_id and client_secret).")
                  else:
                      raise DeviantartError(e)
          else:
              raise DeviantartError('Unknown grant type.')
  
          self.access_token = self.oauth.access_token
docs: Authenticates user and retrieves (and refreshes) access token
  
          :param code: code provided after redirect (authorization_code only)
          :param refresh_token: the refresh_token to update access_token without authorization