question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FCL: Check if user's wallet connection is still valid when creating an authorization request

See original GitHub issue

Problem

Currently, FCL remembers when a user logs into a wallet and persists the connection when user comes back to the dApp page. This is great for UX.

When dApp calls the signing function from fcl.currentUser().authorization, FCL creates a POST request to initiate the authorization process. However, the wallet connection might not be valid anymore at this time, if user comes back to the dApp long after they first logged in. Currently there is no way for the wallet service to tell FCL that the connection is not valid anymore.

Expected

There may be multiple ways to improve the process.

  1. In the signature authorization request, define a response for the wallet service to tell FCL that the connection has already expired.
  2. Before creating the authorization request, define an API to check if the wallet connection is still valid (maybe from some information that /hook API provided).
  3. In /hook API, the wallet provider tells FCL how long the connection will be valid for.

I’d prefer 2 or 3. They will also work for other future requests to the wallet service other than the signature request.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
orodiocommented, Sep 9, 2020

@boczeratul I like the idea of doing it silently, treating it as if we know roughly who they are, but not how to do things on their behalf.

@boczeratul what do you think about this:

  • Treat Authn expiry as fcl.unauthenticate()
  • Treat Authz expiry as fcl.unauthenticate() right before a point that requires an authentication?
0reactions
orodiocommented, Dec 4, 2020

@boczeratul I believe we are correctly respecting the expire value you are sending us, which I think solves this issue. Going to close this, if you find any issues with it let us know and I can re-open.

Read more comments on GitHub >

github_iconTop Results From Across the Web

FCL: Check if user's wallet connection is still valid ... - GitHub
When dApp calls the signing function from fcl.currentUser().authorization , FCL creates a POST request to initiate the authorization process.
Read more >
Flow Client Library (FCL) API Reference - Flow Developers
A convenience method that produces the needed authorization details for the current user to submit transactions to Flow. It defines a signing ...
Read more >
Request for best practices re: wallet / account creation server ...
I'm looking to determine the best practice for creating flow accounts for users server side. The backend of my app is built in...
Read more >
@onflow/fcl - npm
Authentication -- Authenticate Users using FCL wallet providers. ... This guide uses create-react-app and does not require any server-side ...
Read more >
@onflow/sdk | Yarn - Package Manager
To solve this, we created a wallet discovery service that can be configured and accessed through FCL to display all available Flow wallet...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found