```2023/12/21 19:16:37 [Recovery] 2023/12/21 - 19:...
# support-questions-legacy
h
Copy code
2023/12/21 19:16:37 [Recovery] 2023/12/21 - 19:16:37 panic recovered:
interface conversion: interface {} is nil, not map[string]interface {}
/usr/lib/golang/src/runtime/iface.go:262 (0x40cae9)
        panicdottypeE: panic(&TypeAssertionError{iface, have, want, ""})
/home/ec2-user/go/pkg/mod/github.com/supertokens/supertokens-golang@v0.16.4/recipe/thirdparty/providers/oauth2_impl.go:177 (0xadb6d2)
        oauth2_GetUserInfo: rawUserInfoFromProvider.FromUserInfoAPI = userInfoFromAccessToken.(map[string]interface{})
social login thirdpartyemailpassword any idea why this be happening
r
hey @hopinheimer
which social login provider are you trying? Have you overriden any of the provider functions?
h
this is for google and I dont think so I have overriden any provider function
r
right. any custom scopes?
can i see the google provider config you have provided to the golang sdk?
h
nope in fact did not provide any scopes in the config
yeah sure
RecipeList: []supertokens.Recipe{ thirdpartyemailpassword.Init(&tpepmodels.TypeInput{ Providers: []tpmodels.ProviderInput{ { Config: tpmodels.ProviderConfig{ ThirdPartyId: "google", Clients: []tpmodels.ProviderClientConfig{ { ClientID: c.Google.ClientId, ClientSecret: c.Google.ClientSecret, }, }, }, }, { Config: tpmodels.ProviderConfig{ ThirdPartyId: "apple", Clients: []tpmodels.ProviderClientConfig{ { ClientID: c.Apple.ClientId, AdditionalConfig: map[string]interface{}{ "keyId": c.Apple.ClientSecret.KeyId, "privateKey": c.Apple.ClientSecret.PrivateKey, "teamId": c.Apple.ClientSecret.TeamId, }, }, }, }, }, }, Override: &tpepmodels.OverrideStruct{ Functions: user.ThirdpartyWorker, }, }),
r
and also whcih version of the golang sdk
right. Could you please open an issue about this in our golang repo? We will get on fixing it
h
github.com/supertokens/supertokens-golang v0.16.4
sure!
r
also, please make sure tghat trhe client id and secret provided are correct
h
okay yeah I have not checked that let me circle back once check that
r
it does work with the latest golang sdk, and i don't think there are any changes to the google login logic from the version you have till the latest one.
h
understood
hi @rp_st sorry for bothering you on this issue again but I don't seem to be finding a solution to the problem
here's logs with debugging turned on
r
@sattvikc can help here.
also, @hopinheimer could you show us the full error stack?
h
I don't think I got one because it got handled by the handler
r
our middleware doesn't send 500 status code
so maybe you have an error handler that does that. In that handler, you can print out the stack
h
oh okay give me 10mins
My handler isn't handling the errors from supertoken
r
hmm. We definitely don't send 500 status codes
s
this may be happening due to a misconfig, if you could enable debug logs and share with us, we can confirm. it should work with the correct config
h
here are the server logs
here's my config file
s
can you do the signin up with debug logs turned on?
h
yeah the above logs have them
email passwords has no problem but it the google sign is that is causing a problem
Copy code
{
  "redirectURIInfo": {
    "redirectURIOnProviderDashboard": "",
    "redirectURIQueryParams": {
      "code": "4/0AeaYSHCdcxOIvwphmb_xw5Adq2DWZ2L4jPbC9tYfLyFUsZ8yaeUVpZpWoKGgyThEZ0lXaw"
    },
    "user": {
      "email": "0xmartisan@gmail.com",
      "familyName": null,
      "givenName": "martisan",
      "id": "106115034124511399621",
      "name": "martisan",
      "photo": "https://lh3.googleusercontent.com/a/ACg8ocKVLTEvHi9BHoyQm9J7rYa4jRCI4cHGXO9bCbrqOfza=s96-c"
    }
  },
  "thirdPartyId": "google"
}
here's the request body from the frontend for reference
s
are u using a frontend SDK ?
redirectURIOnProviderDashboard
shouldn't be empty
h
frontend is being used but with custom ui
s
sure, but the request body is incorrect
h
I'm using the Authorization code grant flow
swagger docs seem to have PKCE flow
s
pkce is optional based on the flow you are using, you can see the schema (instead of the example)
h
Copy code
{
  "clientType": "web",
  "redirectURIInfo": {
    "redirectURIOnProviderDashboard": "https://auth.traferr-prod.com/auth/callback/google",
    "redirectURIQueryParams": {
      "code": "4/0AeaYSHBJTJvnQVelSk5Fe9PkeQ98ebi-Crv6MXn_Pab0lcOzNY1RAg1VH6veKIcRmd_gnQ"
    }
  },
  "thirdPartyId": "google"
}
s
you can remove
"clientType": "web",
since you have not set it in the backend config
h
still facing the same issue
Copy code
const user = await GoogleSignin.signIn();
    console.log('google signin user', user);
    const requestBody = {
      thirdPartyId: 'google',
      redirectURIInfo: {
        redirectURIOnProviderDashboard: 'https://auth.traferr-prod.com/auth/callback/google',
        redirectURIQueryParams: {
          code: user.serverAuthCode,
        },
      },
    };
    console.log('requestBody', requestBody);
    const response = await fetch(BASE_URL_AUTH + '/auth/signinup', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        rid: 'thirdpartyemailpassword',
      },
      body: requestBody,
    });
here's the frontend code that I'm using
s
what is this doing
const user = await GoogleSignin.signIn();
?
h
it is the google login sdk
s
probably it's already consuming the code, can you try commenting it out
h
import { GoogleSignin, statusCodes, } from '@react-native-google-signin/google-signin';
s
ok, I didn't realise you were using react native
one moment
h
got it
s
I'm not 100% sure at the moment, I'll look into it and get back to you
h
Understood satvik!
s
meanwhile, could you print the error stack from the error handler ?
h
in backend ?
s
yes
h
I tried but I think supertokens does handling
I shutdown all the failsafe
on my part
s
oh okay
I will try it out and let you know
the code seems okay though
h
any specifics on how I should create the google credentials?
s
nothing specific about that
h
I have added all the redirect url and javascript origin from localhost
can you send me a working sample of react native and golang backend?
s
h
I have followed this exactly
r
sorry, can you give us the error stack please?
It will be hard to help without it
2 Views