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

Discovery does not work in Safari, and Chrome incognito mode #106

Closed
cybercent opened this issue Sep 7, 2022 · 13 comments
Closed

Discovery does not work in Safari, and Chrome incognito mode #106

cybercent opened this issue Sep 7, 2022 · 13 comments
Assignees

Comments

@cybercent
Copy link
Contributor

No description provided.

@chasefleming
Copy link
Member

HI @cybercent I just tired https://port.onflow.org on Safari (which is using Discovery) and it works. Can you provide a little more context? Is there a certain wallet or feature that isn't working for you?

Can you also tell us what version of FCL you're having this issue with? Thanks.

@cybercent
Copy link
Contributor Author

cybercent commented Sep 7, 2022

Hi @chasefleming

We are using "@onflow/fcl": "^1.2.0".

The FCL discovery is used inside a react useEffect as explained in the docs.

The network call to fetch the json containing the available wallets is not made by FCL on chrome incognito.

In chrome (non-incognito) the network call is made 100% of the time.

In Safari the call is sometimes made but most of the time not. Reloading the page does not trigger a network call to fetch the available wallets.

Edit:
I've looked at Flow port. The main differences are:

  • the network call is made when the login/signup button is clicked. we make the call on page load.
  • the url is https://fcl-discovery.vercel.app/api/authn, we use https://fcl-discovery.onflow.org/api/authn

@chasefleming
Copy link
Member

Hi @cybercent , helpful info thanks! Yeah, Flow Port is using the UI version of Discovery and sounds like you're using the API version (UI vs API).

I have been able to reproduce this issue using NextJS. I'm guessing that's what you're using? Seems to be related to server side rendered applications. I have a fix for it. We'll get a patch release out soon.

chasefleming added a commit to onflow/fcl-js that referenced this issue Sep 7, 2022
Looks like page loaded before event listeners are added in Safari. Seems to be an issue with SSRs.

Addresses: onflow/fcl-discovery#106
@cybercent
Copy link
Contributor Author

@chasefleming we are not using SSR. But you might be on to something, if I throttle the connection on Safari to cause the page to load slower I sometimes get the network call.

chasefleming added a commit to onflow/fcl-js that referenced this issue Sep 7, 2022
* Update authn.js

Looks like page loaded before event listeners are added in Safari. Seems to be an issue with SSRs.

Addresses: onflow/fcl-discovery#106

* Add changeset

Co-authored-by: Chase Fleming <1666730+chasefleming@users.noreply.github.com>
@chasefleming chasefleming self-assigned this Sep 7, 2022
@chasefleming
Copy link
Member

chasefleming commented Sep 7, 2022

@cybercent I just put a fix in and published an FCL release to 1.3.0-alpha.8. Can you try that version and tell me ifthat solves your issue? That fixed Safari and Incognito on my end.

@cybercent
Copy link
Contributor Author

@chasefleming we tested 1.3.0-alpha.8 and I can confirm that the network call issue is fixed.

It's not clear if the discovery service is meant to return:

A. Only the list of wallets defined here: https://github.com/onflow/fcl-discovery/blob/master/data/services.json

B. The list defined in services.json plus the wallets the user has installed and are not in services.json

@chasefleming
Copy link
Member

@cybercent glad to hear that worked for you!

It depends on your dapp's configuration. Can you post your FCL config (as well as browser) and what you're hoping to see returned? Also, let me know if the browser has any extensions installed.

@isiban
Copy link

isiban commented Sep 8, 2022

@chasefleming our FCL config is the following:

config({
"accessNode.api": "https://rest-testnet.onflow.org", //https://rest-mainnet.onflow.org
"discovery.wallet": "https://fcl-discovery.onflow.org/testnet/authn", //https://fcl-discovery.onflow.org/authn
"discovery.authn.endpoint": "https://fcl-discovery.onflow.org/api/testnet/authn", //https://fcl-discovery.onflow.org/api/authn
})

  • Browser: Chrome 105.0.5195.102

We are hoping to see the wallets defined in: https://github.com/onflow/fcl-discovery/blob/master/data/services.json except Ledger and Dapper (which require another config variables) + other wallets the user has installed and are not in services.json which can be for example NuFi or any other wallet.

@chasefleming
Copy link
Member

Thanks @isiban . Mind also posting the payload being sent over the network at the /authn endpoint so I can see other installations you're mentioning?

And also, can you tell me the response you're getting?

@isiban
Copy link

isiban commented Sep 9, 2022

@chasefleming find bellow the payload and the response I'm getting:

  • Payload
{type: ["authn"], fclVersion: "1.3.0-alpha.8", include: [],…}
clientServices
: 
[{f_type: "Service", f_vsn: "1.0.0", type: "authn", uid: "nufi#authn",…},…]
fclVersion
: 
"1.3.0-alpha.8"
include
: 
[]
supportedStrategies
: 
["HTTP/RPC", "HTTP/POST", "IFRAME/RPC", "POP/RPC", "TAB/RPC", "EXT/RPC"]
type
: 
["authn"]
0
: 
"authn"
userAgent
: 
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36"
  • Response
[{"f_type":"Service","f_vsn":"1.0.0","type":"authn","method":"HTTP/POST","uid":"blocto#authn","endpoint":"https://flow-wallet-testnet.blocto.app/api/flow/authn","provider":{"address":"0xf086a545ce3c552d","name":"Blocto","icon":"/images/blocto.png","description":"Your entrance to the blockchain world.","color":"#afd8f7","supportEmail":"support@blocto.app","authn_endpoint":"https://flow-wallet-testnet.blocto.app/authn","website":"https://blocto.portto.io"}},{"f_type":"Service","f_vsn":"1.0.0","type":"authn","method":"EXT/RPC","uid":"lilico#authn","endpoint":"chrome-extension://hpclkefagolihohboafpheddmmgdffjm/popup.html","provider":{"address":"0x33f75ff0b830dcec","name":"Lilico","icon":"/images/lilico.png","description":"A crypto wallet on Flow built for explorers, collectors, and gamers.","color":"#FC814A","supportEmail":"hi@lilico.app","website":"https://lilico.app","requires_install":true,"is_installed":false,"install_link":"https://chrome.google.com/webstore/detail/lilico/hpclkefagolihohboafpheddmmgdffjm"}}]
  • Installed extensions : NuFi, Lilico, another wallet extension in dev process so not published yet

@chasefleming
Copy link
Member

@isiban forgot to mention that when using the alpha you should point to the preview url generated on this PR: #92

There are a bunch of changes made for the alpha on that branch. When that PR is merged you can switch back to the regular url for Discovery. Still keep the same paths. Just change the origin.

@isiban
Copy link

isiban commented Sep 9, 2022

@chasefleming thanks for the mention 👍🏾
It's working but I'm going to wait for the merge of #92. I have already something working in the meanwhile.

I have a last question about the service provider icon why is it given with a relative path and not an absolute one?

@chasefleming
Copy link
Member

@isiban that's a good catch. Those need to be changed for the API. I made an issue and will get a fix for it: #107

@chasefleming chasefleming reopened this Sep 14, 2022
huyndo pushed a commit to onflow/fcl-js that referenced this issue Sep 24, 2022
* Update authn.js

Looks like page loaded before event listeners are added in Safari. Seems to be an issue with SSRs.

Addresses: onflow/fcl-discovery#106

* Add changeset

Co-authored-by: Chase Fleming <1666730+chasefleming@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: 🏗 In progress
Development

No branches or pull requests

3 participants