Parse-sdk-js: Enable Google OAuth login.

Created on 30 Mar 2019  路  4Comments  路  Source: parse-community/Parse-SDK-JS

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.

enhancement documentation resolved

Most helpful comment

Feel free to submit a PR.

All 4 comments

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?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dblythy picture dblythy  路  4Comments

REPTILEHAUS picture REPTILEHAUS  路  7Comments

adrianchifor picture adrianchifor  路  3Comments

oallouch picture oallouch  路  4Comments

dylankbuckley picture dylankbuckley  路  4Comments