Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document twofactor_totp key validation OCS API #674

Closed
2 of 5 tasks
karakayasemi opened this issue Mar 2, 2019 · 3 comments · Fixed by #1479
Closed
2 of 5 tasks

Document twofactor_totp key validation OCS API #674

karakayasemi opened this issue Mar 2, 2019 · 3 comments · Fixed by #1479
Assignees
Labels
developer docs p3-medium Normal priority waiting on feedback work in progress Still in development. Not to be merged.
Milestone

Comments

@karakayasemi
Copy link
Contributor

What Needs to be Documented?

owncloud/twofactor_totp#38

Where Does This Need To Be Documented?

  • I guess, under Available API's section in developer manual

What Type Of Content Change Is This? (Optional)

  • New Content Addition
  • Old Content Deprecation
  • Existing Content Simplification
  • Bug Fix to Existing Content

Which Manual Does This Relate To? (Optional)

  • Developer Manual
@micbar micbar added this to the Backlog milestone Jul 10, 2019
@micbar micbar added the p3-medium Normal priority label Jul 10, 2019
@micbar micbar modified the milestones: Backlog, Development Jul 15, 2019
@settermjd
Copy link
Contributor

settermjd commented Jul 17, 2019

Hi, @karakayasemi. As part of completing this issue, I've installed the latest version of twofactor_totp from the ownCloud Marketplace (v0.6.0) in my development installation of ownCloud, but have been unable to replicate the stated change in functionality, as described in owncloud/twofactor_totp#38.

I tested the functionality using the following curl request:

curl --silent -u 'admin:admin' \
    http://localhost/ocs/v1.php/apps/twofactor_totp/api/v1/validate/admin/883998?format=json | jq

If "Activate TOTP" is checked and the second-factor authentication code has been verified, the following JSON response is returned:

{
  "ocs": {
    "meta": {
      "status": "failure",
      "statuscode": 997,
      "message": "Unauthorised",
      "totalitems": "",
      "itemsperpage": ""
    },
    "data": []
  }
}

However, if either:

  • "Activate TOTP" is not checked; or
  • "Activate TOTP" is checked but the second-factor authentication code has not been verified, then I receive the following response (which I'd rather expect, to be fair).
{
  "ocs": {
    "meta": {
      "status": "failure",
      "statuscode": 404,
      "message": "OK",
      "totalitems": "",
      "itemsperpage": ""
    },
    "data": {
      "result": false
    }
  }
}

Test Installation Details

Component Version
ownCloud version ownCloud 10.2.1 (stable)
Web server Apache 2.4.29-1ubuntu4.6 amd64 (running on Ubuntu 18.04.2 LTS)
Database server MariaDB 10.3.15-r0 (running on Alpine Linux edge, 3.10_alpha20190408)

@settermjd settermjd added work in progress Still in development. Not to be merged. waiting on feedback labels Jul 17, 2019
@settermjd settermjd reopened this Jul 17, 2019
@karakayasemi
Copy link
Contributor Author

In your tests, you are activating totp for the admin and trying to use same admin account for api call. Currently, when 2FA is activated on an account, authorization with username-password is not possible via API's. The account should authenticate via App passwords when using API's. It is similar on clients. When 2FA is enabled for an user, the user can only login clients via app password.

So, either you can use app password on api call or you can disable 2FA for the admin and create another user for querying its totp validation.

@settermjd
Copy link
Contributor

Thank you for the clarification.

settermjd added a commit that referenced this issue Jul 17, 2019
This change documents the new OCS TOTP Validation API showing what it
is, how to use it, prerequisites, and example responses. It fixes #674.
settermjd added a commit that referenced this issue Jul 18, 2019
This change documents the new OCS TOTP Validation API showing what it
is, how to use it, prerequisites, and example responses. It fixes #674.
settermjd added a commit that referenced this issue Jul 22, 2019
This change documents the new OCS TOTP Validation API showing what it
is, how to use it, prerequisites, and example responses. It fixes #674.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
developer docs p3-medium Normal priority waiting on feedback work in progress Still in development. Not to be merged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants