<@498057949541826571> SuperTokens working with Ionic 6?
v
@rp_st SuperTokens working with Ionic 6?
r
hey @vishal_convasys
im not sure. We haven't tested it. But i do know that someone got it to work with some version of ionic. So i see no reason that it won't work with ionic 6
v
We are developing mobile app using ionic v6 and angular framework. Which documentation should we use for this? WEB(angular) or native(android and ios)?
r
for angular, do you want to use the pre built UI that we have or your own UI?
v
own UI
r
then pick one of the guides, and then follow the "use your own UI" section
v
ok
ionic 6 login is done successfully but i have some issue, did not receive sAccessToken and sFrontToken in cookies. we using localserver for backend, android phone and localserver are connected in same network
r
can i see the response headers of the API call? maybe @nkshah2 can help here
n
Yep, can we see the response headers of the login call?
v
n
Looks like the cookies are being sent, can I see the config you pass to supertokens when initialising it on the backend?
v
ionic : SuperTokens.init({ appInfo: { apiDomain: 'http://192.168.29.127:8080', apiBasePath: "/auth", appName: "Commercial", }, recipeList: [ Session.init(), EmailPassword.init(), ], }); Backend : supertokens.init({ appInfo: config.appInfo, supertokens: { connectionURI: "http://0.0.0.0:3567", apiKey: "", }, recipeList: [ EmailPassword.init(), UserRoles.init(), Session.init(), // initializes session features UserMetaData.init() ] }); appInfo: { appName: "Commercial Console", apiDomain: "http://0.0.0.0:8080", websiteDomain: "http://0.0.0.0" apiBasePath: "/auth", websiteBasePath: "/auth" },
n
The API domain on both frontend and backend should be the same, so you should use the IP for the api domain on the backend as well
v
ok
did not receive sAccessToken and sFrontToken in cookies.
n
They are httponly cookies, you can see the response headers for them
v
how can i print tokens(headers) in console
n
What token are you trying to print?
v
sAccessToken and sIdRefreshToken
n
Those are received as httponly cookies and not as headers
I meant in the network tab of the dev tools, the section for response headers should list the set cookie headers
v
how to send these tokens to backed for varification?
n
When you call APIs on your backend they will be received as cookies
You do not need to manually send them
v
i called http API but cokies not received on backend side
n
Did you change the api domain to be the IP on the backend?
v
yes
n
Can i see the response of the login API?
v
backend side logs?
n
Frontend network tab
v
ok then
Copy code
{
  "status": "OK",
  "user": {
    "email": "demo1234@gmail.com",
    "id": "69c6e827-1963-4404-b2c8-273476b10cf8",
    "timeJoined": 1669636992768
  }
}
n
I need to see the network tab for when you make the request
v
n
Thats the OPTIONS API, can you select the next one
v
n
Can you post the rest of response headers section too
v
n
I meant, in this window there will be more headers
v
n
Right so the cookies are being received, can you hover the warning symbol next to them and see what the error is
v
This attempt to set a cookie via a Set-Cookie header was blocked because it had the "SameSite=Lax" attribute but came from a cross-site response which was not the response to a top-level navigation.
n
Whats the web url you are loading in your app?
v
web url means http post url ?
n
No the url of your app
v
application installed in android mobile and don't understand which url?
n
On your backend can you send the code for where you configure CORS
v
app.enableCors({ origin: true, allowedHeaders: ['content-type', ...supertokens.getAllCORSHeaders()], credentials: true, });
n
On your backend in the session recipe you can set same site to be none instead of lax, see if that helps
v
recipeList: [ EmailPassword.init(), UserRoles.init(), Session.init({ cookieSameSite: 'none' }), // initializes session features UserMetaData.init() ]
already try it.
r
can you try using header based auth instead of cookie based?
v
A single PC (run app and backend) and the same network are working well, but a different PC (run app and backend) and the same network are not working.
Please give me suggestions on what I am doing wrong.
r
hey @vishal_convasys
@nkshah2 will reply as soon as he can.
please be patient
n
Are you facing issues with the header based auth based on the example rp linked or are you still using cookie based auth?
v
I had tried both, but the same issue.
n
Can I see the full config on both the frontend and backend
v
n
When you say it wasnt working for different pc on the same network, were you seeing any errors?
v
I have a warning on the network tab in the response header (This attempt to set a cookie via a Set-Cookie header was blocked because it had the "SameSite=Lax" attribute but came from a cross-site response which was not the response to a top-level navigation.)
n
Right so you have commented out all the overrides for the session recipe (the configuration you have commented is the part that enabled header based auth)
v
After signing the warning is not coming but getting some data I have shows errors GET http://192.168.29.179:3001/projects 401 (Unauthorized) POST http://192.168.29.179:3001/auth/session/refresh 401 (Unauthorized)
n
Just to clarify, have you signed in with the code commented or uncommented?
v
uncommented
n
Might be easier to debug this on call
v
Are you comfirtable in Hindi?
n
Sure
v
I'll be able to explain better ni hindi
n
Yep im comfortable in Hindi
v
It is working fine. @nkshah2 @rp_st Thank you so much for helping me
n
Happy to help
r
nice! thanks
18 Views