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.

Why is getAccounts() now asynchronous?

See original GitHub issue

The changes from #436 were only just released in 0.3.1-alpha so I’m just learning about the breaking changes now even though the commit that changed it was from back in October of last year.

Can you explain why getAccounts() is now asynchronous? This has proved to be quite annoying to migrate. Also, as noted in #548 and #544 there are still numerous cases that benefit from or even require a synchronous method of accessing this information.

If the reason is that the ADAL migration takes too long to perform on the main thread, please know that some users (hey, it me!) are not migrating from ADAL.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
shoatmancommented, Jun 11, 2019

@joshfriend - Thanks for the suggestions! Very much appreciated. I’m going to publish a TODOs as you suggest shortly and look forward to your feedback. Thanks again!

0reactions
rpdomecommented, Oct 28, 2019

We introduced synchronous (blocking) APIs in MSAL v1.0.0 (needs to be running on a background thread) - This includes getAccounts(), getAccount(), removeAccount() and acquireTokenSilent()

Read more comments on GitHub >

github_iconTop Results From Across the Web

Async Problem With getAccounts() : r/ethdev - Reddit
Adding async means getCurrentAccount() returns a Promise. So this part too needs to be inside an async, or deal with the returned promise....
Read more >
Async with getAccounts - web3js - Ethereum Stack Exchange
getAccounts() returns an array async function getCurrentAccount(){ const currentAccounts = await web3.eth.
Read more >
Why web3.eth.getAccounts().then(console.log) return empty ...
You now need to request permission from the user to get their accounts. So instead of getAccounts() , use requestAccounts() : web3.eth.
Read more >
What is the best way to fix this code? - Moralis Web3 Forum
Thanks ivan! I got the code fixed, i had extra IF statement in a function, the running code is now: export const loadAccount...
Read more >
web3-eth.Eth.getAccounts JavaScript and Node.js ... - Tabnine
async onClick() { try { //Grab all the accounts from metamask const accounts = await web3.eth.getAccounts(); this.setState({ message: "Choosing a winner.
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