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
support-questions
  • r

    rp

    07/07/2021, 12:36 PM
    is this for github?
  • s

    sahil-shubham

    07/07/2021, 12:44 PM
    Yes, the built in provider.
  • r

    rp

    07/07/2021, 12:44 PM
    I'll have to have a look at the github docs for their scopes
  • r

    rp

    07/07/2021, 12:45 PM
    cause we don't modify how the scopes you give are sent to github in any way..
  • s

    sahil-shubham

    07/07/2021, 12:45 PM
    But we don't give any scope for the built in providers right?
  • s

    sahil-shubham

    07/07/2021, 12:46 PM
    Only for the custom ones.
  • r

    rp

    07/07/2021, 12:46 PM
    you can give for the built in as well.
  • s

    sahil-shubham

    07/07/2021, 12:48 PM
    I didn't find this mentioned anywhere in the docs. Could you share the link whenever possible.
  • r

    rp

    07/07/2021, 12:48 PM
    yes
  • r

    rp

    07/07/2021, 12:48 PM
    https://github.com/supertokens/supertokens-node/blob/master/lib/ts/recipe/thirdparty/providers/github.ts#L23
  • r

    rp

    07/07/2021, 12:49 PM
    So you would use:
    Github.init({
      clientId: ...,
      clientSecret: ...,
      scope: ["scope1", "scope2", ...]
    })
  • s

    sahil-shubham

    07/07/2021, 12:52 PM
    Cool, thank you very much.
  • u

    user

    07/08/2021, 12:46 AM
    How can one obtain information like the first name, last name, and profile when using Google as a third party sign up option
  • r

    rp

    07/08/2021, 4:07 AM
    @User , you need to use the override feature to have post sign up / in callbacks: https://supertokens.io/docs/thirdpartyemailpassword/common-customizations/handling-signinup-success#3-handling-signin-signup-event-on-the-backend If you see the code, you get
    thirdPartyAuthCodeResponse
    , which is the response that google returned which contains all the user's info (depending on the scope provided) + access and refresh tokens to query google's APIs.
  • r

    rp

    07/08/2021, 4:38 AM
    The above works only for the node SDK >= v6.0.0
  • g

    gusfune

    07/08/2021, 10:29 AM
    Hey, is there any known issue with ST-react in Safari? I am getting a weird
    404
    on
    /api/auth/session/refresh
    , during refresh session attempts. That's on the latest version.
  • r

    rp

    07/08/2021, 10:29 AM
    This happens only on Safari?
  • g

    gusfune

    07/08/2021, 10:31 AM
    Actually the 404 happens in every browser, but the other cascading behavior (not ST related) is only in safari.
  • g

    gusfune

    07/08/2021, 10:31 AM
    In safari it errors saying headers already setn.
  • g

    gusfune

    07/08/2021, 10:31 AM
    sent
  • r

    rp

    07/08/2021, 10:32 AM
    So is the path
    api/auth/session/refresh
    correct? according to your backend?
  • r

    rp

    07/08/2021, 10:32 AM
    As in, are all the supertokens apis listening on
    /api/auth/*
    ?
  • g

    gusfune

    07/08/2021, 10:33 AM
    Yes, it works nicely on Chrome/Firefox, on Safari it gives an HEADER_ALREADY_SENT error on that path. All paths are to
    /api/auth/*
  • r

    rp

    07/08/2021, 10:33 AM
    hmmm
  • r

    rp

    07/08/2021, 10:33 AM
    Can I see the full error message?
  • g

    gusfune

    07/08/2021, 10:35 AM
    [POST] /api/auth/session/refresh
    11:25:19:59
    2021-07-08T09:25:19.781Z    80afeb81-c13a-45ef-8272-d06132bda786    ERROR    Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client    at ServerResponse.setHeader (_http_outgoing.js:561:11)    at sendJson (/var/task/node_modules/next/dist/next-server/server/api-utils.js:37:5)    at ServerResponse.apiRes.json (/var/task/node_modules/next/dist/next-server/server/api-utils.js:6:297)    at handler (/var/task/main/.next/server/pages/api/order/cart.js:30:21)    at processTicksAndRejections (internal/process/task_queues.js:95:5) {  code: 'ERR_HTTP_HEADERS_SENT'}2021-07-08T09:25:19.784Z    80afeb81-c13a-45ef-8272-d06132bda786    ERROR    Uncaught Exception     {"errorType":"Error","errorMessage":"write after end","code":"ERR_STREAM_WRITE_AFTER_END","stack":["Error [ERR_STREAM_WRITE_AFTER_END]: write after end","    at writeAfterEnd (_http_outgoing.js:694:15)","    at ServerResponse.end (_http_outgoing.js:815:7)","    at sendError (/var/task/node_modules/next/dist/next-server/server/api-utils.js:62:129)","    at apiResolver (/var/task/node_modules/next/dist/next-server/server/api-utils.js:8:373)","    at processTicksAndRejections (internal/process/task_queues.js:95:5)","    at async Server.handleApiRequest (/var/task/node_modules/next/dist/next-server/server/next-server.js:66:462)","    at async Object.fn (/var/task/node_modules/next/dist/next-server/server/next-server.js:58:580)","    at async Router.execute (/var/task/node_modules/next/dist/next-server/server/router.js:25:67)","    at async Server.run (/var/task/node_modules/next/dist/next-server/server/next-server.js:68:1042)","    at async Server.handleRequest (/var/task/node_modules/next/dist/next-server/server/next-server.js:32:504)"]}Unknown application error occurred
  • r

    rp

    07/08/2021, 10:35 AM
    Ah ok.. it's a backend related error.
  • r

    rp

    07/08/2021, 10:36 AM
    Can I see your auth.js file on the backend? which uses the supertokens-node middleware?
  • g

    gusfune

    07/08/2021, 10:36 AM
    ts
    import { NextApiRequest, NextApiResponse } from "next"
    import NextCors from "nextjs-cors"
    import { superTokensNextWrapper } from "supertokens-node/nextjs"
    import { middleware, init, getAllCORSHeaders } from "supertokens-node"
    import { backendConfig } from "../../../data/supertokens"
    
    init(backendConfig())
    
    export default async function superTokens(
      req: NextApiRequest,
      res: NextApiResponse
    ) {
      await NextCors(req, res, {
        methods: ["GET", "HEAD", "PUT", "PATCH", "POST", "DELETE"],
        origin: [/\.offscript\.io$/, /\.vercel\.app$/],
        credentials: true,
        allowedHeaders: ["content-type", ...getAllCORSHeaders()],
      })
      await superTokensNextWrapper(
        async (next) => {
          await middleware()(req, res, next)
        },
        req,
        res
      )
      if (!res.writableEnded) {
        res.status(404).send("Not found")
      }
    }
  • r

    rp

    07/08/2021, 10:36 AM
    Seems right..
Powered by Linen
Title
r

rp

07/08/2021, 10:36 AM
Seems right..
View count: 2