We have a React/Capacitor application wired up to use web3Auth + Discord Login. We have used the following guide Discord Guide to get setup & have it working successfully for WEB & IOS. But we are currently running into an issue with native android devices.
At the moment when a user triggers the discord login from within our app the user is redirected to the following page (Open Login) & nothing happens, upon further investigation of the source maps we get an error about redirectUrl
does not exist. But we have set that in our adapterSettings
.
Here is a snippet of our initialization code.
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const web3AuthInit = async () => { try { setInitLoading(true) const web3authCore = new Web3AuthCore({ chainConfig: { chainNamespace: CHAIN_NAMESPACES.EIP155, chainId: '0x1', rpcTarget: 'https://mainnet.infura.io/v3/776218ac4734478c90191dde8cae483c', blockExplorer: 'https://etherscan.io/', ticker: 'ETH', tickerName: 'Ethereum', }, enableLogging: true, }) const adapter = new OpenloginAdapter({
adapterSettings: {
network: 'testnet',
clientId:
'XXX',
uxMode: 'redirect',
redirectUrl: "XXX"
loginConfig: {
discord: {
name: 'discord',
verifier: 'discord-learn-card-verifier',
typeOfLogin: 'discord',
clientId: 'XXX',
mainOption: true,
showOnMobile: true,
showOnDesktop: true,
},
},
},
})
web3authCore.configureAdapter(adapter)
subscribeAuthEvents(web3authCore)
web3AuthStore.set.web3Auth(web3authCore)
await web3authCore.init()
} catch (error) {
setInitLoading(false)
console.log(error)
}
}">
const web3AuthInit = async () => {
try {
setInitLoading(true)
const web3authCore = new Web3AuthCore({
chainConfig: {
chainNamespace: CHAIN_NAMESPACES.EIP155,
chainId: ‘0x1’,
rpcTarget:
‘https://mainnet.infura.io/v3/776218ac4734478c90191dde8cae483c’,
blockExplorer: ‘https://etherscan.io/’,
ticker: ‘ETH’,
tickerName: ‘Ethereum’,
},
enableLogging: true,
})<span class="pl-k">const</span> <span class="pl-s1">adapter</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-v">OpenloginAdapter</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">adapterSettings</span>: <span class="pl-kos">{</span> <span class="pl-c1">network</span>: <span class="pl-s">'testnet'</span><span class="pl-kos">,</span> <span class="pl-c1">clientId</span>: <span class="pl-s">'XXX'</span><span class="pl-kos">,</span> <span class="pl-c1">uxMode</span>: <span class="pl-s">'redirect'</span><span class="pl-kos">,</span> <span class="pl-c1">redirectUrl</span>: <span class="pl-s">"XXX"</span> <span class="pl-s1">loginConfig</span>: <span class="pl-kos">{</span> <span class="pl-s1">discord</span>: <span class="pl-kos">{</span> <span class="pl-c1">name</span>: <span class="pl-s">'discord'</span><span class="pl-kos">,</span> <span class="pl-c1">verifier</span>: <span class="pl-s">'discord-learn-card-verifier'</span><span class="pl-kos">,</span> <span class="pl-c1">typeOfLogin</span>: <span class="pl-s">'discord'</span><span class="pl-kos">,</span> <span class="pl-c1">clientId</span>: <span class="pl-s">'XXX'</span><span class="pl-kos">,</span> <span class="pl-c1">mainOption</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span> <span class="pl-c1">showOnMobile</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span> <span class="pl-c1">showOnDesktop</span>: <span class="pl-c1">true</span><span class="pl-kos">,</span> <span class="pl-kos">}</span><span class="pl-kos">,</span> <span class="pl-kos">}</span><span class="pl-kos">,</span> <span class="pl-kos">}</span><span class="pl-kos">,</span> <span class="pl-kos">}</span><span class="pl-kos">)</span> <span class="pl-s1">web3authCore</span><span class="pl-kos">.</span><span class="pl-en">configureAdapter</span><span class="pl-kos">(</span><span class="pl-s1">adapter</span><span class="pl-kos">)</span> <span class="pl-en">subscribeAuthEvents</span><span class="pl-kos">(</span><span class="pl-s1">web3authCore</span><span class="pl-kos">)</span> <span class="pl-s1">web3AuthStore</span><span class="pl-kos">.</span><span class="pl-c1">set</span><span class="pl-kos">.</span><span class="pl-en">web3Auth</span><span class="pl-kos">(</span><span class="pl-s1">web3authCore</span><span class="pl-kos">)</span> <span class="pl-k">await</span> <span class="pl-s1">web3authCore</span><span class="pl-kos">.</span><span class="pl-en">init</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">}</span> <span class="pl-k">catch</span> <span class="pl-kos">(</span><span class="pl-s1">error</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> <span class="pl-en">setInitLoading</span><span class="pl-kos">(</span><span class="pl-c1">false</span><span class="pl-kos">)</span> <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s1">error</span><span class="pl-kos">)</span> <span class="pl-kos">}</span>
}
Originally posted by: gerardopar
Check the discussion at: https://github.com/orgs/Web3Auth/discussions/460