https://supertokens.com/ logo
Title
v

vishalc

11/29/2022, 7:06 AM
@rp SuperTokens working with Ionic 6?
r

rp

11/29/2022, 7:09 AM
hey @vishalc
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

vishalc

11/29/2022, 7:17 AM
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

rp

11/29/2022, 7:22 AM
for angular, do you want to use the pre built UI that we have or your own UI?
v

vishalc

11/29/2022, 7:28 AM
own UI
r

rp

11/29/2022, 7:28 AM
then pick one of the guides, and then follow the "use your own UI" section
v

vishalc

11/29/2022, 7:30 AM
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

rp

11/29/2022, 8:32 AM
can i see the response headers of the API call? maybe @nkshah2 can help here
n

nkshah2

11/29/2022, 8:33 AM
Yep, can we see the response headers of the login call?
v

vishalc

11/29/2022, 8:38 AM
n

nkshah2

11/29/2022, 8:39 AM
Looks like the cookies are being sent, can I see the config you pass to supertokens when initialising it on the backend?
v

vishalc

11/29/2022, 8:50 AM
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

nkshah2

11/29/2022, 8:50 AM
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

vishalc

11/29/2022, 8:55 AM
ok
did not receive sAccessToken and sFrontToken in cookies.
n

nkshah2

11/29/2022, 9:06 AM
They are httponly cookies, you can see the response headers for them
v

vishalc

11/29/2022, 9:35 AM
how can i print tokens(headers) in console
n

nkshah2

11/29/2022, 9:58 AM
What token are you trying to print?
v

vishalc

11/29/2022, 10:06 AM
sAccessToken and sIdRefreshToken
n

nkshah2

11/29/2022, 10:07 AM
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

vishalc

11/29/2022, 10:11 AM
how to send these tokens to backed for varification?
n

nkshah2

11/29/2022, 10:12 AM
When you call APIs on your backend they will be received as cookies
You do not need to manually send them
v

vishalc

11/29/2022, 10:29 AM
i called http API but cokies not received on backend side
n

nkshah2

11/29/2022, 10:30 AM
Did you change the api domain to be the IP on the backend?
v

vishalc

11/29/2022, 10:31 AM
yes
n

nkshah2

11/29/2022, 10:31 AM
Can i see the response of the login API?
v

vishalc

11/29/2022, 10:31 AM
backend side logs?
n

nkshah2

11/29/2022, 10:32 AM
Frontend network tab
v

vishalc

11/29/2022, 10:32 AM
ok then
{
  "status": "OK",
  "user": {
    "email": "demo1234@gmail.com",
    "id": "69c6e827-1963-4404-b2c8-273476b10cf8",
    "timeJoined": 1669636992768
  }
}
n

nkshah2

11/29/2022, 10:44 AM
I need to see the network tab for when you make the request
v

vishalc

11/29/2022, 10:44 AM
n

nkshah2

11/29/2022, 10:45 AM
Thats the OPTIONS API, can you select the next one
v

vishalc

11/29/2022, 10:46 AM
n

nkshah2

11/29/2022, 10:47 AM
Can you post the rest of response headers section too
v

vishalc

11/29/2022, 10:49 AM
n

nkshah2

11/29/2022, 10:49 AM
I meant, in this window there will be more headers
v

vishalc

11/29/2022, 10:51 AM
n

nkshah2

11/29/2022, 10:51 AM
Right so the cookies are being received, can you hover the warning symbol next to them and see what the error is
v

vishalc

11/29/2022, 10:55 AM
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

nkshah2

11/29/2022, 11:12 AM
Whats the web url you are loading in your app?
v

vishalc

11/29/2022, 11:17 AM
web url means http post url ?
n

nkshah2

11/29/2022, 11:18 AM
No the url of your app
v

vishalc

11/29/2022, 11:24 AM
application installed in android mobile and don't understand which url?
n

nkshah2

11/29/2022, 11:31 AM
On your backend can you send the code for where you configure CORS
v

vishalc

11/29/2022, 11:34 AM
app.enableCors({ origin: true, allowedHeaders: ['content-type', ...supertokens.getAllCORSHeaders()], credentials: true, });
n

nkshah2

11/29/2022, 11:35 AM
On your backend in the session recipe you can set same site to be none instead of lax, see if that helps
v

vishalc

11/29/2022, 12:09 PM
recipeList: [ EmailPassword.init(), UserRoles.init(), Session.init({ cookieSameSite: 'none' }), // initializes session features UserMetaData.init() ]
already try it.
r

rp

11/29/2022, 12:10 PM
can you try using header based auth instead of cookie based?
v

vishalc

11/30/2022, 10:31 AM
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

rp

12/01/2022, 5:10 AM
hey @vishalc
@nkshah2 will reply as soon as he can.
please be patient
n

nkshah2

12/01/2022, 5:17 AM
Are you facing issues with the header based auth based on the example rp linked or are you still using cookie based auth?
v

vishalc

12/01/2022, 5:20 AM
I had tried both, but the same issue.
n

nkshah2

12/01/2022, 5:32 AM
Can I see the full config on both the frontend and backend
v

vishalc

12/01/2022, 5:53 AM
n

nkshah2

12/01/2022, 6:06 AM
When you say it wasnt working for different pc on the same network, were you seeing any errors?
v

vishalc

12/01/2022, 6:11 AM
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

nkshah2

12/01/2022, 6:13 AM
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

vishalc

12/01/2022, 6:31 AM
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

nkshah2

12/01/2022, 6:35 AM
Just to clarify, have you signed in with the code commented or uncommented?
v

vishalc

12/01/2022, 6:44 AM
uncommented
n

nkshah2

12/01/2022, 6:46 AM
Might be easier to debug this on call
v

vishalc

12/01/2022, 6:47 AM
Are you comfirtable in Hindi?
n

nkshah2

12/01/2022, 6:47 AM
Sure
v

vishalc

12/01/2022, 6:48 AM
I'll be able to explain better ni hindi
n

nkshah2

12/01/2022, 6:48 AM
Yep im comfortable in Hindi
v

vishalc

12/01/2022, 11:31 AM
It is working fine. @nkshah2 @rp Thank you so much for helping me
n

nkshah2

12/01/2022, 11:31 AM
Happy to help
r

rp

12/01/2022, 11:55 AM
nice! thanks