reactjs-social-login
reactjs-social-login copied to clipboard
Unable to get the code for server
Describe the bug I want to get the user code from my reactjs application. I will then pass the code to my server-side to get the auth-token along with refresh token. UUnfortunately, I am getting profile info and access token only. I could not get the code.
To Reproduce Steps to reproduce the behavior:
<LoginSocialGoogle
isOnlyGetCode={true}
client_id={socialAuthProps.google.key}
onLoginStart={onLoginStart}
onResolve={({ provider, data }) => {
setProvider(provider)
setProfile(data)
}}
onReject={(err) => {
console.log(err)
}}
>
<GoogleLoginButton />
</LoginSocialGoogle>```
**Expected behavior**
code in the response
**Desktop (please complete the following information):**
- OS: Macintosh
- Browser Chrome
- Version 106
Hi. What is the user code you are mentioning?
Hi, As per the OAuth specification, we can pass &response_type=code params. So, once the user is authenticated, we will get a code in response to our redirect URL. This code will be passed to our server-side (back-end) to authenticate from our application backend session.
Using the code, we will get the refresh-token to renew the user session with oauth provider to get a new auth key.
Also, isOnlyGetCode={true} there is no difference regardless of true or false in this config.
As far as I know, the new mechanism doesn't get code on response. You can try downgrading to version 2.7.1.
By looking at the code (https://www.npmjs.com/package/reactjs-social-login), i see the latest version is 2.5.6. I am not sure what you mean by 2.7.1
oh, sorry about that. I mean version 2.0.1