nik2208.2208
11/13/2023, 12:38 PMoverride: {
functions: (originalImplementation) => {
return {
...originalImplementation,
// override the thirdparty sign in / up API
signInUp: async function(input) {
// TODO: Some pre sign in / up logic
let response = await originalImplementation.signInUp(input);
if (response.status === "OK") {
// This is the response from the OAuth tokens provided by the third party provider
let accessToken = response.oAuthTokens["access_token"];
// other tokens like the refresh_token or id_token are also
// available in the oAuthTokens object.
// This gives the user's info as returned by the provider's user profile endpoint.
let firstName = response.rawUserInfoFromProvider.fromUserInfoAPI!["first_name"];
// This gives the user's info from the returned ID token
// if the provider gave us an ID token
let lastName = response.rawUserInfoFromProvider.fromUserInfoAPI!["last_name"];
}
return response;
}
}
}
}
in the ThirdPartyEmailPassword.init() function in config.ts provided by the pre build code.
Once here, what am I supposed to do to get name and surname? store it in metadata and then retrieve them through an api call?rp_st
11/13/2023, 1:00 PMnik2208.2208
11/13/2023, 1:04 PMawait UserMetadata.updateUserMetadata(userId, { name: fistName });
within that function? If yes, where do I get session/user data to make the call?rp_st
11/13/2023, 1:31 PMnik2208.2208
11/13/2023, 1:53 PMSuperTokens is an open source authentication solution offering features like: Different types of login: Email / password, Passwordless (OTP or Magic link based).
Powered by