Hey guys, awesome project, love it I 've been debugging this for a few hours. What could be the rea...
m
Hey guys, awesome project, love it I 've been debugging this for a few hours. What could be the reason that I don't have
sRefreshToken
cookie. What would be useful information I can provide?
Copy code
import SuperTokens from 'supertokens-node'
import { middleware } from 'supertokens-node/framework/awsLambda'

import { config } from '../lib/supertokens'

SuperTokens.init(config)

export const handler = middleware()
r
Hey @muhajirdev
The refresh token is attached to the refresh path. So you need to navigate to that (/auth/session/refresh) by default in order to see it
m
I see, If i go to /auth/session/refresh in my browser (get request) I will be able to see it in the cookie?
r
U should. Yea
The domain should be the apiDomain
m
ah okay so I found this , is it normal?
If i open it directly I got this
r
Yea. You have setup things incorrectly it seems
What’s your appInfo object on the backend and frontend?
m
okay let me paste it here
Copy code
{
api |   framework: 'awsLambda',
api |   isInServerlessEnv: true,
api |   appInfo: {
api |     apiDomain: 'http://localhost:8910',
api |     websiteDomain: 'http://localhost:8910',
api |     appName: 'SuperTokens RedwoodJS',
api |     apiGatewayPath: '/.redwood/functions',
api |     websiteBasePath: '/auth',
api |     apiBasePath: '/auth'
api |   },
api |   supertokens: { connectionURI: 'https://try.supertokens.io' },
api |   recipeList: [ [Function (anonymous)], [Function (anonymous)] ]

}
this is backend
Copy code
{
  "appInfo": {
    "apiDomain": "http://localhost:8910",
    "websiteDomain": "http://localhost:8910",
    "apiGatewayPath": "/.redwood/functions",
    "appName": "SuperTokens RedwoodJS",
    "websiteBasePath": "/auth",
    "apiBasePath": "/auth"
  },
  "recipeList": [
    null,
    null
  ]
}
and this is frontend
the recipelist on the frontend becomes null when I log it for some reason
so is it actually normal not having
sRefreshToken
in the cookie? @rp_st or it's not normal
I was using the example here https://github.com/redwoodjs/playground-auth I have found that when using latest redwood 3.0, it's not working properly anymore. It was fine on redwood 0.5
that's sad , I am already on 3.0. But I cannot use supertokens
One thing I have found when using the logger (I use this http://middy.js.org/docs/middlewares/input-output-logger/ ) is that the backend actually send the setHeader with sRefreshToken, but somehow it is not delivered to the browser
seems like the SetCookie is intercepted somehow.
r
Well, it’s probably some config issue and that’s why it’s not working.
What’s the value of apiBasePath on the frontend?
m
I found more clue @rp_st I found this response header actually includes
sRefreshToken
I copied it from my browser
my assumption is that there's permission issue, cors or something
I figured out the issue my local server only send
set-Cookie
. while it should send 3 set cookie
r
What’s the set-cookie value it has?
Also, what the apiBasePath value on the frontend?
m
It’s okay @rp_st . The problem is in the framework that I used (redwoodjs) . I found a fix , finally. I will submit a PR the to redwood repo
Thanks for helping @rp_st . Appreciate it 🙏👏
r
awesome!!
m
Btw, @rp_st . Is it possible to use custom user_id. Instead of supertoken-core generate the uuid. Can the node sdk give the user_id to be inserted in the supertokens table ?
r
hey yea there is. Checkout the user_id_mapping functions from the SDK
@jscyo can help here
2 Views