A MERN Stack app which uses Oauth2 to login to Onshape. There are two simple examples to retrieve data.
- Get user units.
- Get a gltf of an assembly.
This consist of both a frontend react client and a backend express node server. Mongo is used to keep track of session data. In production, these are run from a server. This, however, is setup to all run locally.
Onshape is used for Authentication . Based on the Authentication , the react-router handles the Authorization and routes the user to the appropriate route. This is a very simple example and should not be used for production.
More Info:
Instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.
Use this as a template to create your own external Onshape app using the MERN Stack.
A .env file is require at the root of the client and server.
REACT_APP_OS_OAUTH_CLIENT_KEY=<OS_OAUTH_CLIENT_KEY>
PORT=4000
NODE_ENV=DEVELOPMENT
APP_NAME=onshape-mern-oauth-external
SESSION_SECRET=godtac
OS_OAUTH_CLIENT_KEY=<OS_OAUTH_CLIENT_KEY>
OS_OAUTH_SECRET_KEY=<OS_OAUTH_SECRET_KEY>
OS_OAUTH_REDIRECT_URL=http://localhost:4000/oauthRedirect
OS_OAUTH_AUTHORIZATION_URL=https://oauth.onshape.com/oauth/authorize
OS_OAUTH_TOKEN_URL=https://oauth.onshape.com/oauth/token
OS_OAUTH_USER_PROFILE_URL=https://cad.onshape.com/api/users/sessioninfo
JWT_ACCESS_SECRET=ad4d5548a61ad283abf3f89d361b79b18a37a69970610150ffb2895917f2b71bea
Distributed under the MIT License. See LICENSE
for more information.