jazlalli / getting-started-with-react

Some literature and code resources introducing React
MIT License
3 stars 0 forks source link

oauth 2 client example with react router #1

Open jitchavan opened 8 years ago

jitchavan commented 8 years ago

Hi,

looking into the below issue details. you have implemented oauth implementation with react router. https://github.com/rackt/react-router/issues/2082

are you able to post that as an example.

any help will be much appreciated.

knowbody commented 8 years ago

@jitchavan Could you be more precise on what you are looking for? I'm not sure if I understand your request, sorry

jitchavan commented 8 years ago

@knowbody @jazlalli posted below code in https://github.com/rackt/react-router/issues/2082

import React from 'react';
import {Router, Route, IndexRoute} from 'react-router';
import createBrowserHistory from 'history/lib/createBrowserHistory';

const router = (
  <Router history={createBrowserHistory()}>
    <Route path="/" component={App}>
      <IndexRoute component={Login} />
      <Route path="oauthcallback" component={OAuth} />
      <Route path="home" component={Home} />

      <Route path="sqms">
        <IndexRoute component={Sqms} />
      </Route>

      <Route path="est">
        <IndexRoute component={Est} />
      </Route>
    </Route>
  </Router>
);

React.render(router, document.getElementById('content'));

i am looking specifically for below implementation. how he is implemented this. and what oauth client library he is using.

<Route path="oauthcallback" component={OAuth} />

where he specified as below.

It kicks off an OAuth flow by redirecting to an external URL, which calls back to the /oauthcallback route. The OAuth component processes the parameters, and when it's done calls this.history.pushState(null, '/home');.