Is your feature request related to a problem? Please describe.
Parse Server currently supports Google OAuth login:
https://docs.parseplatform.org/parse-server/guide/#google-authdata
The SDK does not.
Describe the solution you'd like
I would like to support _linkWith('google', {}) for Google OAuth, as described in the server docs.
Describe alternatives you've considered
I've shimmed it in to my current project that uses Google client-side log in, but this is hacky.
Additional context
I'd be willing to put up the change, I just wanted to see if there was some operational reason why this wasn't implemented.
Feel free to submit a PR.
would be great to get all that is supported in parse-server into the sdk. would be even greater-er to get another contributor contributing! thanks.
Update now that I'm actually digging around in the code.
By inspecting the code itself, Google (and I suspect the other integrations) work just fine with a different payload format:
const user = await new Parse.User()._linkWith('google', {authData: {id, id_token}});
This differs slightly from the authData that Parse Server specifies:
{
"google": {
"id": "user's Google id (string)",
"id_token": "an authorized Google id_token for the user (use when not using access_token)",
"access_token": "an authorized Google access_token for the user (use when not using id_token)"
}
}
These work because the SDK implementation of _linkWith reshuffles the data to send straight to the server. This just requires us to document that this is, in fact, how to do it, or we can accept the Parse Server format in addition to this other format. Thoughts?
I think this just involves updating https://docs.parseplatform.org/js/guide/#linking-users to document this behaviour. If y'all think that's reasonable, I'll open a PR there. Also, if this functionality becomes supported, I'd also like to write some tests on our end to cover this use case.
@bezi I submitted a PR https://github.com/parse-community/docs/pull/615, can you review it?
Most helpful comment
Feel free to submit a PR.