Closed MarcGodard closed 9 months ago
In Strategy.js
Changing this:
async getEntityQuery(profile, _params) {
console.log(profile)
return {
[`${this.name}Id`]: profile.sub || profile.id
};
}
async getEntityData(profile, _existingEntity, _params) {
console.log(profile)
return {
[`${this.name}Id`]: profile.sub || profile.id
};
}
To this (in my node_module files):
async getEntityQuery(profile, _params) {
console.log(profile)
return {
[`${this.name}Id`]: profile?.sub ?? String(profile.id)
};
}
async getEntityData(profile, _existingEntity, _params) {
console.log(profile)
return {
[`${this.name}Id`]: profile?.sub ?? String(profile.id)
};
}
Made it work for both Google and Github.
Hm, after applying your fix I'm now getting this error:
info: Feathers app listening on http://FlexibeleJonas2:3030
undefined
error: TypeError: Cannot read properties of undefined (reading 'id')
at GitHubStrategy.getEntityQuery (C:\1_LOKALE_PROJECTEN\BloxTech\ResearchAndDevelopment\Feathersjs\feathers-chat\node_modules\@feathersjs\authentication-oauth\lib\strategy.js:30:64)
at GitHubStrategy.findEntity (C:\1_LOKALE_PROJECTEN\BloxTech\ResearchAndDevelopment\Feathersjs\feathers-chat\node_modules\@feathersjs\authentication-oauth\lib\strategy.js:81:34)
at GitHubStrategy.authenticate (C:\1_LOKALE_PROJECTEN\BloxTech\ResearchAndDevelopment\Feathersjs\feathers-chat\node_modules\@feathersjs\authentication-oauth\lib\strategy.js:120:44)
@JonasTheGamer Not sure why you are getting this, other than you are not requesting that information? Is this with google or github? I didn't test other services, as I thought this was close enough to the original not to impact others.
@MarcGodard I had get the same error. I think you didn't started the Database server. Please start the database server and then try again. I think the error description is wrong.
@gypsicoder I don't think the database had anything to do with it.
It looks like it is a bug, there are more details reported in https://github.com/feathersjs/feathers/issues/3275 - basically it seems like an error happened (which is why there isn't a profile) but went through the process normally. Needs some more investigation but should be fixed in the next release.
This should be fixed via #3284 in v5.0.9 and propagate the error that likely happened here (instead of just returning an undefined profile).
I keep having this issue on v5 (no problem on v4) and I am not sure if it is because of my config or still a bug from feathers oauth. Profile data is empty and the authentication method does not return the google token while no oauth error is shown
Steps to reproduce
Expected behavior
No error and user created
Actual behavior
Above Error
System configuration
Brand new feathers 5.0.8 project (javascript, npm, json schemas)
Module versions (especially the part that's not working): 5.0.8
NodeJS version: v16
Operating System: linux