Add in API for callback.

Open
#14 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript
Domain
frontend, web-dev

Research direction

Start by reading the callback flow described in the issue and inspect the app’s URL detection and dialog entry points. Compare the proposed same-domain validation with the x-callback-url and window.open/postMessage options, then decide which flow fits the stated constraints. Done means a callback can return results safely and the dialog presents the requested app-specific action; the issue names no files or tests.

Written by the indexing model from the issue text.

Description

It should be possible to launch the API with a callback to a URL that will post the results there

Ideal UI

  • When URL detected, open up the dialog with the OPEN, CANCEL, SHARE button in
  • Include a new button with the name of the app and the domain of the callback
  • Ideally we should validate the callback against the referrer. So we only share back to the same domain (for now)

Some additional research

  • x-callback-url http://x-callback-url.com/ (Zxing seems to use this), useful way to call back directly into the APP - we can't check the referrer though because it uses a custom scheme
  • Could use an intent URL on Android and target and app, we probably want to disable this for now unless we know it is going back directly into the calling app.
  • window.open and postMessage are options to send back data, it has a relatively complex API and it won't work with out JS. with x-callback-url, I could do it on the server.

Issues

x-callback-url:

  • It's incrediblly hard to workout which web site called you and directly get back into the running instance of the site that invoked your app, instead you can only manage forward only requests. App->QR->App and that might mean a new page load etc, network round trips and also offline issues.
Dominant language
JavaScript
Stars
375
Forks
479
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from PaulKinlan/qrcode

All issues in PaulKinlan/qrcode

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.