https://supertokens.com/ logo
Docs
Join the conversationJoin Discord
Channels
community
contributing
general
github-activity
info
introductions
new-releases
random
security
support-questions
welcome-0xdelusion
welcome-aj-ya
welcome-aleksandrc
welcome-alpinjs
welcome-amberlamps1
welcome-andrew-rodriguez
welcome-ankit-choudhary
welcome-anthony-stod-custodio
welcome-call-in
welcome-chwalbox
welcome-claybiokiller
welcome-co7e
welcome-cosmoecwsa
welcome-devdag
welcome-dinso
welcome-drebotelho
welcome-elio
welcome-ernest
welcome-foxbarrington
welcome-fromscratch
welcome-galto4ir
welcome-goetzum
welcome-hay-kot
welcome-himanshu-kukreja
welcome-hossambarakat
welcome-ichikawakazuto
welcome-jahir9991
welcome-jamesl
welcome-jerry123424
welcome-john-oliver
welcome-jonas-alexanderson
welcome-jxyz
welcome-kelvinwop
welcome-kraz
welcome-lancekey
welcome-leoo
welcome-lukeacollins
welcome-m-j-mon
welcome-malik-khoja
welcome-marco
welcome-mardadi
welcome-meshguy
welcome-metamorph
welcome-mike-tectu
welcome-mirzok
welcome-mozomig
welcome-naberyou66_
welcome-nacer
welcome-namratha
welcome-naveenkumar
welcome-nightlight
welcome-nischith
welcome-notankit
welcome-olawumi
welcome-pavan-kumar-reddy-n
welcome-pineappaul
welcome-poothebear
welcome-rick
welcome-samuel-qosenergy
welcome-samuelstroschein
welcome-shubhamgoel23
welcome-shubhamkaushal
welcome-sidebar
welcome-surajsli
welcome-suyash_
welcome-syntaxerror
welcome-tauno
welcome-tauno
welcome-tawnoz
welcome-teclali
welcome-tls
welcome-turbosepp
welcome-vikram_shadow
welcome-yann
Powered by Linen
general
  • s

    Sun Walker

    06/14/2020, 11:28 PM
    Build was successful but get loads of warnings??
  • s

    Sun Walker

    06/14/2020, 11:28 PM
    and things that don't exist
  • n

    nkshah2

    06/15/2020, 3:48 AM
    In Android studio in your folder structure delete the .idea directory. Then File > Invalidate cache and restart. Try this @Sun Walker . Sometimes building in Android studio gums up a few things
  • n

    nkshah2

    06/15/2020, 3:50 AM
    Also just try hitting alt + enter on clicking on any of the missing symbol warnings and see if Android studio can auto resolve them
  • r

    rp

    06/15/2020, 5:12 AM
    thanks @User . @User have a look at this example: https://github.com/supertokens/supertokens-react-native/blob/master/Example/android/app/src/main/java/com/example/MainApplication.java. It may help resolve your issues.
  • s

    Sun Walker

    06/15/2020, 11:44 AM
    @rp noice, works good, also perhaps that'd be good to add to the docs
  • r

    rp

    06/15/2020, 11:48 AM
    yea!
  • s

    Sun Walker

    06/16/2020, 4:45 PM
    Hey @User why is this coming back as an unhandled error on react native
  • s

    Sun Walker

    06/16/2020, 4:45 PM
    Response {
      "_bodyBlob": Blob {
        "_data": Object {
          "__collector": Object {},
          "blobId": "684EFC19-282D-4351-B18F-F5867E415EC8",
          "name": "refresh",
          "offset": 0,
          "size": 1383,
          "type": "application/json",
        },
      },
      "_bodyInit": Blob {
        "_data": Object {
          "__collector": Object {},
          "blobId": "684EFC19-282D-4351-B18F-F5867E415EC8",
          "name": "refresh",
          "offset": 0,
          "size": 1383,
          "type": "application/json",
        },
      },
  • s

    Sun Walker

    06/16/2020, 4:46 PM
    "headers": Headers {
        "map": Object {
          "access-control-allow-credentials": "true",
          "access-control-expose-headers": "id-refresh-token, anti-csrf",
          "anti-csrf": "2147e6e2-5e56-46d5-a408-4e462b3fe229",
          "connection": "keep-alive",
          "content-encoding": "gzip",
          "content-type": "application/json; charset=utf-8",
          "date": "Tue, 16 Jun 2020 16:44:07 GMT",
          "etag": "W/\"567-wUbSNrVsti+Zw4kRHc1R5Ma0hpM\"",
          "id-refresh-token": "7825bd80-045b-4c40-8ae4-27694af3dd0b;1592325907773",
          "set-cookie": "sAccessToken=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsInZlcnNpb24iOiIxIn0%3D.eyJzZXNzaW9uSGFuZGxlIjoiZmY5YjhkMjUtM2RkYS00Y2U4LThmZWYtOWRlODAwOGI4MWE5IiwidXNlcklkIjoiNDExNWM1ZGYtOGNmMS00MDI5LWE1NjUtZDRlZWNiZDczNDU4IiwicmVmcmVzaFRva2VuSGFzaDEiOiJkZjQxYmQwZDk0MjkwNjU3ZGU2ODI3ODY5MDA5OGM3YjU2MWEyYTRkYzk3ZDg3NTQ0Y2EyYWI2YjVmZjBhMDUzIiwicGFyZW50UmVmcmVzaFRva2VuSGFzaDEiOiI4MjNkNDY1NzQwNjgwYTg4N2FmNTFmY2RiZDdhMzIzOWYwOGVjZDY2Njg2YTdlNTkwYWY3NjYwNTViM2JiYmQ5IiwidXNlckRhdGEiOnsidXNlclR5cGUiOiJhZG1pbiIsImlzUHJvdmlkZXIiOnRydWV9LCJhbnRpQ3NyZlRva2VuIjoiMjE0N2U2ZTItNWU1Ni00NmQ1LWE0MDgtNGU0NjJiM2ZlMjI5IiwiZXhwaXJ5VGltZSI6MTU5MjMyNTg1Nzc3NSwidGltZUNyZWF0ZWQiOjE1OTIzMjU4NDc3NzUsImlzUGFpZCI6ZmFsc2V9.Jv2RDFHkUySiyUXVtxQEJwGdsSDG1ONSY%2Baf%2BiVz1tB5
  • s

    Sun Walker

    06/16/2020, 4:46 PM
    "strict-transport-security": "max-age=15552000; includeSubDomains",
          "transfer-encoding": "Identity",
          "vary": "Origin, Accept-Encoding",
          "x-content-type-options": "nosniff",
          "x-dns-prefetch-control": "off",
          "x-download-options": "noopen",
          "x-frame-options": "SAMEORIGIN",
          "x-xss-protection": "1; mode=block",
        },
      },
      "ok": true,
      "status": 201,
      "statusText": undefined,
      "type": "default",
      "url": "http://127.0.0.1:4000/refresh",
    }
  • s

    Sun Walker

    06/16/2020, 4:46 PM
    message has been deleted
  • s

    Sun Walker

    06/16/2020, 4:57 PM
    export const attemptRefreshSession = async (req: Request, res: Response) => {
      try {
        await refreshSession(req, res);
        return env !== 'development' ? true : developmentCookieResponse(res);
      } catch (err) {
        const authError = Error.isErrorFromAuth(err);
    
        if (authError && err.errType === Error.UNAUTHORISED) {
          throw createHttpError(440, {
            message: 'Unauthorized. Please Login.',
            err,
          });
        }
        if (authError && err.errType !== Error.GENERAL_ERROR) {
          const sessionHandle = err?.err?.sessionHandle;
          const successfulRevoke = await revokeSession(sessionHandle);
          throw createHttpError(440, {
            message: `${successfulRevoke ? 'Session Revoked. ' : ''}Please Login.`,
            err,
          });
        }
        throw createHttpError(500, { err });
      }
    };
  • s

    Sun Walker

    06/16/2020, 4:57 PM
    export const refresh: Route = {
      method: 'post',
      path: '/refresh',
      secure: false,
      handler: [
        async (req, res) => {
          const success = await attemptRefreshSession(req, res);
          return res
            .status(201)
            .send({ success, message: 'Successful Session Refresh.' });
        },
      ],
    };
  • r

    rp

    06/16/2020, 5:02 PM
    You don't need to do refreshing of tokens on your own - it is handled by the SDK on it's own. You just need to add inteceptors to your fetch or axios
  • r

    rp

    06/16/2020, 5:02 PM
    @User - If i undertsand your code correctly that is.
  • s

    Sun Walker

    06/16/2020, 5:08 PM
    Yeah the axios has interceptors @rp Im using the one provided (supertokens.axios) with credentials
  • r

    rp

    06/16/2020, 5:09 PM
    I see. So that should do the refreshing on its own.
  • s

    Sun Walker

    06/16/2020, 5:09 PM
    it all works great but whenever I post to /refresh it gives back an error? what should i do ? (it still successfully refreshes)
  • s

    Sun Walker

    06/16/2020, 5:09 PM
    Ah so I can delete my /refresh?
  • s

    Sun Walker

    06/16/2020, 5:09 PM
    I dont do any /refresh calls it does call it on its own
  • s

    Sun Walker

    06/16/2020, 5:10 PM
    it just comes back as an error whenever the access token gets refreshed
  • s

    Sun Walker

    06/16/2020, 5:30 PM
    Also @User I've set this to 1 minute but it takes longer than 1 minute to expire it seems
    # (OPTIONAL | Default: 144000) double value. Time in mins for how long a refresh token is valid for.
    refresh_token_validity: 1
  • s

    Sun Walker

    06/16/2020, 5:30 PM
    It expires in less than 30 minutes but not 1 minute
  • s

    Sun Walker

    06/16/2020, 5:31 PM
    I know this because the sdk is making successful refreshreshes every 10 seconds (for way longer than 1 minute) as I put this:
    # (OPTIONAL | Default: 3600) integer value. Time in seconds for how long an access token is valid for.
    access_token_validity: 10
    (which are working well, but coming back as errors to the client)
  • s

    Sun Walker

    06/16/2020, 5:34 PM
    Perhaps the refreshes change the time...
  • r

    rp

    06/16/2020, 5:41 PM
    > Ah so I can delete my /refresh? In your backend APIs, no.
  • r

    rp

    06/16/2020, 5:42 PM
    > I've set this to 1 minute So this means that it will expire after 1 min of inactivity. If you call a refresh API within 1 min, the session lifetime will be extended by one more min.
  • s

    Sun Walker

    06/16/2020, 5:44 PM
    I see!
  • s

    Sun Walker

    06/16/2020, 5:44 PM
    so if user is inactive for 144000 mins by default
Powered by Linen
Title
s

Sun Walker

06/16/2020, 5:44 PM
so if user is inactive for 144000 mins by default
View count: 2