reactjs - Login with Google, using a Ruby on Rails API and React -


i'm current trying implement login google option make easier user login , create user.

i have rails api uses devise login, , front using react makes requests rails 5 api.

im not sure if have login on end or @ front end, greatest problem create user when login google, because cannot create user without password.

i never created kinda of login system i'm not sure how works, believe have implement in end, using google oauth gem, wanna know if has tips how it.

should use react components only? rails gems only? or both correct answer?

thank you.

i give direction archive this.

first thing, have figure out grant flow going use in oauth provider.

there 4 ways it, list common 2 ways.

  1. code grant flow (used in website omniauth-google or similar gem use way)

  2. implicit grant flow (native app, means have oauth flow in front-end)

if going implement api server, should consider second way.

because api server should stateless, first way need session save state of oauth flow.

besides, devise not idea implement api server, should consider jwt or token-like authentication.

although, enable session store within rails api use devise or omniauth-series.

if want oauth in front-end, go second way.

or add button link oauth callback url in react component, web server deal oauth flow(this first way).

after considering situation, suggest use first way.

because there many resource devise , omniauth-series find on internet.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -