-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how do i add more scopes to fetch phone numbers? #10
Comments
I think you can do passport.use(new GoogleOauthTokenStrategy({
clientID: GOOGLE_CLIENT_ID,
clientSecret: GOOGLE_CLIENT_SECRET,
scope: [''],
}, (accessToken, refreshToken, profile, cb) => {
User.findOrCreate({ googleId: profile.id }, (error, user) => {
return done(error, user);
});
})); For typescript, I will update the typing later |
Doesn't work :(
|
I see, lemme try to debug it |
because I am busy recently, so it will take time |
@sarunmrzn I tried to debug, but I couldn't get the phone number from this https://developers.google.com/oauthplayground. Can you test the scope here and lemme know the result? |
it seems to get the phone number, you should change the profileURL to |
@sarunmrzn please help me to confirm, so I can provide a solution for this package. Thank you |
@zgid123 changing profile URL to
|
@sarunmrzn I mean you should check using the |
I checked for myself, and it does not respond phone number using the current url that this package is using. Only this one |
ok, so basically, you cannot get the phone number via So for the current version, when validate the I am rework this package to typescript and try to pass the custom parser, so you can parse it to whatever schema you want |
I tried in the playground, I still can't get the phone number with the url you specified, but if it works for you, please update the package, I'll try it out after. Thank you |
@sarunmrzn you can test with new version 1.0.5. Check my example for nestjs here |
I did this exact same thing but I still dont get phoneNumbers key you're receiving, maybe it's got to do something with account itself, I'm going to test this on my other accounts and see if I can get the field.
I upgraded the version and copied interface types but still throws me |
@sarunmrzn is your phone number public? If not, googleapis won't respond it for you. Also please provide me the code that you are using, I will have a look at your code |
"passport-google-oauth-token": "^1.0.5" I will test with other google accounts and let you know if this works |
how did you get the refresh_token + access_token? |
I'm using |
can you provide a codesandbox project? I will have a look tonight. I think it is because you missed some config for |
here. I didn't do anything fancy on it, just used the hook button and called the nestjs api and attached access_token to the body this works very well with your package, it just doesnt fetch phone numbers, I'm strongly suspecting its just my account that isn't fetching phone numbers because I cant even get those in the playground, I'll test it with some other accounts later today and let you know the update for it |
I just tested with a friend's google account to fetch phone number on playground, it works on his account, just not mine for some reason. Does the 1.0.5 fetches phone numbers for you? I think we can mark this as solved if it does. |
I tried to use your code to test, but my google app always rejects my request. I still not find out why. For the package, the example code for nestjs from this repository can work and can get the phone number (url: |
@sarunmrzn ok, I think I found out the problem in your case. To fix your issue, you will need to do
(1) code example const login = useGoogleLogin({
scope: 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/user.phonenumbers.read openid https://www.googleapis.com/auth/userinfo.profile',
flow: 'implicit',
onSuccess: (codeReponse) => {
console.log(codeReponse);
//axios post call backend login api and I attached access_token: codeResponse.access_token
},
}); (2) for more info about the personFields, you can check here |
Lemme know if you have another issue. Feel free to close this issue when your problem is fixed. If not, please provide me the error that you are facing. I will have a look. It would be better if you provide an example repository. I will have a look at your repository |
We gave up on this, apparenlty even when there are phone numbers on authorization code flow it doesn't show up phone numbers, we just moved to manually adding phone number verification after sign up. Thanks for all effort you put into this, I will however try your solution on my a separate project. For now I'll close this. Thanks agian. |
No description provided.
The text was updated successfully, but these errors were encountered: