LoginFlow V2

Login flow v2 is an authorization process for the standard Nextcloud client that allows each client to have their own set of credentials.

class nc_py_api.loginflow_v2._LoginFlowV2API(session: NcSession)[source]

Class implementing Nextcloud Login flow v2.

init(user_agent: str = 'nc_py_api') LoginFlow[source]

Init a Login flow v2.

Parameters:

user_agent – Application name. Application password will be associated with this name.

poll(token: str, timeout: int = 1200, step: int = 1, overwrite_auth: bool = True) Credentials[source]

Poll the Login flow v2 credentials.

Parameters:
  • token – Token for a polling for confirmation of user authorization.

  • timeout – Maximum time to wait for polling in seconds, defaults to MAX_TIMEOUT.

  • step – Interval for polling in seconds, defaults to 1.

  • overwrite_auth – If True current session will be overwritten with new credentials, defaults to True.

Raises:

ValueError – If timeout more than 20 minutes.

class nc_py_api.loginflow_v2.Credentials(raw_data: dict)[source]

The Nextcloud Login flow v2 response with app credentials representation.

property server: str

The address of Nextcloud to connect to.

The server may specify a protocol (http or https). If no protocol is specified https will be used.

property login_name: str

The username for authenticating with Nextcloud.

property app_password: str

The application password generated for authenticating with Nextcloud.

class nc_py_api.loginflow_v2.LoginFlow(raw_data: dict)[source]

The Nextcloud Login flow v2 initialization response representation.

property login: str

The URL for user authorization.

Should be opened by the user in the default browser to authorize in Nextcloud.

property token: str

Token for a polling for confirmation of user authorization.

property endpoint: str

Endpoint for polling.