productdevbook
01/05/2023, 7:56 AMrp
01/05/2023, 8:25 AMproductdevbook
01/05/2023, 9:13 AMrp
01/05/2023, 9:13 AMproductdevbook
01/05/2023, 9:13 AMadb shell am start -W -a android.intent.action.VIEW -d "https://aa.com/auth/callback/github?code=396asdasdas6158a82d19ad" com.aa.aa
this working
but
adb shell am start -W -a android.intent.action.VIEW -d "https://aa.com/auth/callback/github?code=396asdasdas6158a82d19ad&state=bd29d9d38c67893c22a7c" com.aa.aa
dont open two params problem how to fixed ?rp
01/05/2023, 9:14 AMproductdevbook
01/05/2023, 9:14 AMrp
01/05/2023, 9:15 AMproductdevbook
01/05/2023, 9:20 AMts
<script lang="ts" setup>
import ThirdPartyEmailPassword from 'supertokens-web-js/recipe/thirdpartyemailpassword'
const router = useRouter()
onMounted(async () => {
try {
// we try and consume the authorisation code sent by the social login provider.
// this knows which third party provider has sent the user back because
// we store that in localstorage when the user clicks on the provider's button
// on the sign in / up screen
const response = await ThirdPartyEmailPassword.thirdPartySignInAndUp({})
if (response.status !== 'OK')
// this means that the third party provider does not have an email associated
// with this user. In this case, we disallow the sign in and show a message
// on the login UI
return router.push('/auth?error=signin')
// login / signup is successful, and we redirect the user to the home page.
// Note that session cookies are added automatically and nothing needs to be
// done here about them.
setTimeout(() => {
router.push('/home')
}, 500)
}
catch (_) {
// we show a something went wrong error in the auth page.
router.push('/auth?error=signin')
}
})
</script>
<template>
<IonPage>
<IonContent>
<div class="flex flex-col space-y-12 items-center justify-center">
<span class="sr-only">Loading...</span>
<p>
<span class="text-sm text-gray-500 dark:text-dark-400">
Account is being created...
</span>
</p>
</div>
</IonContent>
</IonPage>
</template>
rp
01/05/2023, 10:15 AMconsole.log(response)
and show me the output?productdevbook
01/05/2023, 10:19 AMrp
01/05/2023, 10:59 AMawait ThirdPartyEmailPassword.thirdPartySignInAndUp({})
get executed?productdevbook
01/05/2023, 11:02 AMts
onMounted(async () => {
console.log('0')
try {
console.log('1')
const response = await ThirdPartyEmailPassword.thirdPartySignInAndUp({})
console.log(response, '2')
if (response.status !== 'OK')
return router.push('/auth?error=signin')
setTimeout(() => {
router.push('/home')
}, 500)
}
catch (err) {
console.log('3', err)
// we show a something went wrong error in the auth page.
router.push('/auth?error=signin')
}
})
rp
01/05/2023, 11:06 AMproductdevbook
01/05/2023, 11:06 AMts
3
Error: Auth state verification failed. The auth provider responded with an invalid state
at Object.<anonymous> (supertokens-web-js_recipe_thirdpartyemailpassword.js?v=367c206e:1690:23)
at step (supertokens-web-js_recipe_thirdpartyemailpassword.js?v=367c206e:1464:23)
at Object.next (supertokens-web-js_recipe_thirdpartyemailpassword.js?v=367c206e:1411:18)
at supertokens-web-js_recipe_thirdpartyemailpassword.js?v=367c206e:1392:71
at new Promise (<anonymous>)
at __awaiter (supertokens-web-js_recipe_thirdpartyemailpassword.js?v=367c206e:1374:14)
at Object.verifyAndGetStateOrThrowError (supertokens-web-js_recipe_thirdpartyemailpassword.js?v=367c206e:1678:18)
at Object.<anonymous> (supertokens-web-js_recipe_thirdpartyemailpassword.js?v=367c206e:2107:99)
at step (supertokens-web-js_recipe_thirdpartyemailpassword.js?v=367c206e:1988:23)
at Object.next (supertokens-web-js_recipe_thirdpartyemailpassword.js?v=367c206e:1935:18)
rp
01/05/2023, 11:10 AMproductdevbook
01/05/2023, 11:18 AMrp
01/05/2023, 11:19 AMproductdevbook
01/05/2023, 11:25 AMts
async function onGithubPressed() {
const authorisationURL = props.mobile
? `${MOBILE_URL}/auth/callback/github`
: `${FRONTEND_URL}/auth/callback/github`
const authUrl = await ThirdPartyEmailPassword.getAuthorisationURLWithQueryParamsAndSetState({
providerId: 'github',
// This is where github should redirect the user back after login or error.
// This URL goes on the github dashboard as well.
authorisationURL,
})
if (props.mobile)
window.open(authUrl, '_self')
else
window.location.assign(authUrl)
}
https://site.com/auth/callback/github?code=56b15c548aaaaaaa85b8e9458d&state=f1776e5aaa067347bc1cb46c"
rp
01/05/2023, 11:26 AMcode
query param, but no state
query paramproductdevbook
01/05/2023, 11:26 AMrp
01/05/2023, 11:27 AMproductdevbook
01/05/2023, 11:28 AMrp
01/05/2023, 11:28 AMproductdevbook
01/05/2023, 11:29 AMrp
01/05/2023, 11:29 AMproductdevbook
01/05/2023, 2:52 PM<data android:scheme="http" android:host="localhost" android:port="3000" />
add android
adb shell am start -a android.intent.action.VIEW -d "http://localhost:3000/auth/callback/github?code=asdasdas\&state=aasda123123" com.xx.xx
dont fixed same problem