openid / AppAuth-JS

JavaScript client SDK for communicating with OAuth 2.0 and OpenID Connect providers.
Apache License 2.0
983 stars 161 forks source link

Add a React Web Example #153

Closed KevinDanikowski closed 4 years ago

KevinDanikowski commented 4 years ago

Documentation Desired

Working example of react with appauth-JS

There is a web example of appauth-js, however there is not a web example using the popular react framework (not react-native to clarify). There is a sufficient example with a nodeJS server and electron, however the request handler for a web application must be different. It would be appreciated to have a react example (preferably with some sort of auth hook).

Reference to a POC of a working React Example

I've made a POC with create-react-app, It's located here (https://github.com/KevinDanikowski/appauth-js-react-sample) and I would have no problem with this code being taken and hosted somewhere aside from my local repo, or even referencing my repo is fine. I would prefer to have an auth hook to be used by other components, I may be adding that in the coming days.

tikurahul commented 4 years ago

FWIW, there is a simple sample app here: https://github.com/openid/AppAuth-JS/blob/master/app/index.html

KevinDanikowski commented 4 years ago

@tikurahul correct, I used it to create the react one, however it doesn't return callbacks in the auth flow constructor and it isn't the same as the flow in react, and thus I believe there should be an example for react (not to mention I really wanted to see one so I didn't have to figure it out myself! haha).

tikurahul commented 4 years ago

👍🏼