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

fix(oauth2): adjust db schemas when migrating from owncloud #50193

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

st3iny
Copy link
Member

@st3iny st3iny commented Jan 15, 2025

Summary

See also #49075

This PR fixes two issues:

  1. Not being able to create or auth using OAuth2 clients after migrating from ownCloud.
  2. Not being able to refresh legacy tokens from ownCloud after migrating to Nextcloud.

It does not aim to migrate legacy access tokens from ownCloud as this incurs a lot of work and tokens are only valid for an hour. So, it does not make sense as the migration window set by admins is probably longer than their lifetime anyway.

What I tested

  1. Install ownCloud (latest) and install/enable the oauth2 app.
  2. Add an oauth2 client, use it to generate an access token and refresh it at least once.
  3. Dump related tables: mysqldump owncloud oc_oauth2_access_tokens oc_oauth2_refresh_tokens oc_oauth2_clients
  4. Import dumped tables into Nextcloud.
  5. Reset all oauth2 migrations and drop oauth2 tables (oc_oauth2_access_tokens, oc_oauth2_refresh_tokens and oc_oauth2_clients).
  6. Import dumped tables.
  7. Migrate oauth2 and run repair steps: occ migrations:migrate oauth2 && occ maintenance:repair
  8. Refresh the token generated in step 2 using your oauth2 client (might be necessary to adjust the token URL if Nextcloud is on another domain).
  9. Observe that the refreshed access token can still be used to log into Nextcloud.

TODO

  • Needs to be tested with a live ownCloud instance (see above)

Checklist

@st3iny st3iny marked this pull request as ready for review January 16, 2025 10:51
@st3iny st3iny added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Jan 16, 2025
Copy link
Member

@ChristophWurst ChristophWurst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far

@st3iny
Copy link
Member Author

st3iny commented Jan 20, 2025

/backport! to stable29

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🏗️ In progress
3 participants