No instance of EmailPassword found. Make sure to c...
# support-questions-legacy
s
No instance of EmailPassword found. Make sure to call the EmailPassword.init method why this error occurs when using await ThirdParty.signInAndUp({})
r
Hey! Which SDK is this from?
And can I see your supertokens init function?
s
supertokens web js sdk
r
Have you called supertokens.init?
s
yes in useeffect hook on app.js
r
Can I see it? Also, you want to make sure that the init function is called before using any of these functions.
The error message you are seeing is incorrect in the SDK by the way. It should be that no instance of ThirdParty found. We will fix that.
But essentially, you want to move the init call to be on the global scope of your app. And not in a userEffect
s
any fix??
r
Are you using axios or fetch?
s
fetch
r
You need to make sure that you are calling supertokens.init on all your pages (if you are doing a fill page reload) and that it’s getting called before making any API call
s
yeah for every page the init method will get called
r
Right. Can you enable debug logging and show me the output of that when you call the API that returns 401?
s
yeah its my and ive used to get uid using session from api calls
its from verify session () in supertokens
r
Yea. Can you enable debug logging from the frontend and show me the output of the logs?
So I can see why it’s not doing automatic refreshing of the session
s
weird
r
so you are calling init, but it's not taking effect?
s
see on the first image config variable... but on next hit theres nothing
it was working perfectly fine for 10 minutes
r
im not sure what you mean by "theres nothing".
Where are you calling supertokens.init exactly?
you need to make sure to call it outside of your App component. On the global scope
s
hi the logs you asked
changed ThirdParty to ThirdPartyEmailPassword just like your example app for testing purposes
r
can i see the import statement for how you are importing the supertokens class on which you call init?
s
import SuperTokens from "supertokens-web-js"; import Session from "supertokens-web-js/recipe/session"; import ThirdPartyEmailPassword from "supertokens-web-js/recipe/thirdpartyemailpassword"; SuperTokens.init({ appInfo: { appName: "dashdrop", apiDomain: "http://localhost:3001", // websiteDomain: config.website_url, // apiBasePath: "/", // websiteBasePath: "/auths", }, recipeList: [ ThirdPartyEmailPassword.init(), Session.init(), // ThirdParty.init() ], enableDebugLogs: true, });
r
hmmj. this seem about right
can we get on a call to debug this? It's really strange.
i think the issue might be that when the callback is getting called from google, the page you load on your site to handl that callback does not end up calling the init function.
s
Are you the owner of the repo?
r
Yea
s
Kk cool.. ill ask my team for a gmeet if thats ok with you!
r
Yea sure. You can book a time with us from our website.
s
hey solved the issue... the init should be called in index.js.. and it solves half the issue.. then you should call a sessioninfo from backend to restore the session.. so i thought best why not call sessioninfo for every refresh
r
You don’t need to call sessioninfo at all. You don’t even need that api on the backend.
s
but if i make accesstoken expire the access token doesnt save by itself
so..... what to do
r
If the access token has expired, when you call any api that requires session verification, it will cause the refresh flow to happen. Which happens automatically.
s
oh kk thank you
297 Views