Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
oauth what is it?
billy2
Member, OS Professional, Mentor, Developers, User Group Leader Posts: 2,071 PRO
1
Comments
1. It starts with the web address and in my case its:
https://rndengineering.com/pro/
2. There's no parameters sent in this address so I capture this and send the user to onshape. Here's the code that checks for parameters and re-locates to onshape:
3. This sends the user off to Onshape so they can allow the user to sign in. Upon success, they'll send the user back to my site base on a url return address I registered in the app store. Here's the updated address Onshape sends back:
https://rndengineering.com/pro/?code=vfmAcpHiNkFRkl
The url address above won't work if you copy it into a browser, it's a deadend and goes nowhere, timed out. Notice that Onshape adds a code to the url.
4. With a code returned from Onshape, I request a token from Onshape:
The ultimate piece of information, the reason for all this interaction is inside $token.
5. Grab the 'access_token'. It's needed for all subsequent calls to Onshape servers and it only lasts for 60 minutes. Get the access token:
Here's a video link to my latest code:
R&D pro release candidate
Thanks for the app! Looks really useful. Lack of display states & better property management has been a big deal for adoption of OS by my engineers. Will look forward to your next releases and in meantime I am going to start testing it out.
www.virtualmold.com
I have the steps in php & nodejs. There's plenty of python examples. Have you checked out the github repository for onshape?
My code isn't commented and probably would do more harm than good if I posted it.
oauth is a simple dance between your client, your server & onshape.
Look at the github and if that doesn't work, then I'll compose a video showing how it's done. That might be best.