Add async registration flow for devices - #7820
Conversation
cstns
left a comment
There was a problem hiding this comment.
Looking very good overall, just a few minor nitpicks from me. The most important one is the rate limiter on the registration endpoint.
| <div class="ff-layout--plain"> | ||
| <div class="ff-header"> | ||
| <!-- Mobile: Icon-only logo --> | ||
| <img class="ff-logo lg:hidden" src="/ff-minimal-red.svg" alt="FlowFuse"> |
There was a problem hiding this comment.
this should be wrapped in an anchor link to enable navigation when clicked.
Found myself in a situation where i couldn't navigate back home without altering the url. Also worth adding a home button under the The registration session you are trying to use is invalid or has expired. Please start the registration process again. notice, similar to our 404 pages
There was a problem hiding this comment.
Added a 'back to dashboard' button to help the user escape.
There was a problem hiding this comment.
Clicking this should take the user back home still. Hovering over the FF logo shows a pointer cursor, but clicking does nothing. The rest of the layouts all link home, so this would match.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #7820 +/- ##
==========================================
+ Coverage 75.64% 75.67% +0.03%
==========================================
Files 434 436 +2
Lines 23268 23359 +91
Branches 6184 6204 +20
==========================================
+ Hits 17600 17678 +78
- Misses 5668 5681 +13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
cstns
left a comment
There was a problem hiding this comment.
tested well, with a single note. Also postponing approval until we get the rate limiter sorted
| "version": "17.7.0", | ||
| "resolved": "https://registry.npmjs.org/globals/-/globals-17.7.0.tgz", | ||
| "integrity": "sha512-Czmyns5dUsq4seFBR/Kdydhmo8y9kC79hiSkPn0YcGtNnYWnrgt0vjrSjx9tspoDGWm2CMarffRuLjM4xUz8xg==", | ||
| "version": "17.8.0", |
There was a problem hiding this comment.
package-lock.json changes might need reverted
|
Migration clashes with This was causing the endpoint to Note also - PR is not using template (no check box to indicate migration) |
|
@Steve-Mcl have you got the latest? I renamed the migration yesterday via ca75095 Also, I may not have the checklist, but the migration label was applied from the start. |
That is super weird! I could swear I was looking at the GH page this morning (around 8:10am) it could swear it said I guess I had an earlier fetch and hadn't pulled and didnt actually look at the files in the wepage (but rather the local FS in IDE 🤷 ) Anyhow, you are indeed correct (I have re-checked) - no action required. |
Closes #7731
This creates an async device registration service that allows a Device Agent to direct a user to a URL to get their device registered, and have the OTC registration code get returned to the device.
We don't have the corresponding Device Agent changes (yet), but to test this PR you can simulate it on the command line.
In these examples, I'm assuming you are testing against a forge app running on
localhost:3000- you'll need to adjusted the hostname/port as appropriate.Start an async registration:
This will return an JSON object with
registerUrlanddoneUrl. Note they are actually paths rather than full URLs.Open
registerUrlin your browser. It will take you through the device registration process. At the end, it shows you the OTC for the newly registered device.Poll the
doneUrlin the background - it will return202status code whilst the registration process is in progress. Once the device has been registered, this url will return200with theotcin the payload object. It will only do this once - subsequent requests will 404.I have added UTs for the backend apis that cover all the interactions with the API. I have not done any UI Test coverage.
To fully test, this requires the device agent from FlowFuse/device-agent#704
There are a couple items outstanding (that may be follow up PRs)billing notification (show the pricing table if the device registration will incur charges)check the full end-to-end "a user has to sign-up first, then gets redirected back to this flow". I have done that a couple times, but need to double check it all.