Skip to content

Commit 6c1ba0f

Browse files
committed
feat(example support OAuth): example add method about OAuth
1 parent bcdd0a9 commit 6c1ba0f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

example/basic-dapp/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@
5151
Wallet
5252
</button>
5353
<footer>
54-
Address: <span id="address">N/A</span>
54+
<p>Address: <span id="address">N/A</span></p>
55+
<p>OAuth Code: <span id="oauth_code">N/A</span></p>
5556
</footer>
5657
</article>
5758
<article>

example/basic-dapp/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,12 +491,17 @@ async function walletInitialized() {
491491

492492
const deployContract = getElement('deploy_contract')
493493

494-
function authed(address) {
494+
async function authed(address) {
495495
if (!address || address === '') {
496496
return unAuthed()
497497
}
498+
const oauthCode = await provider.request({
499+
method: 'anyweb_oauth',
500+
})
498501
getElement('address').innerHTML = address
502+
getElement('oauth_code').innerHTML = oauthCode
499503
console.log('authed address: ', address)
504+
console.log('OAuth Code: ', oauthCode)
500505
sendNativeTokenButton.disabled = false
501506
approveButton.disabled = false
502507
transferFromButton.disabled = false

0 commit comments

Comments
 (0)