You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Daniel Rodriguez edited this page Feb 16, 2023
·
3 revisions
This guide will walk you through how to setup OAuth2 for API access on behalf of your clients using web flow.
Step 1 - Creating OAuth2 credentials
Follow the steps for the product you're using to generate a client ID and secret, as well as callback URLs that can be handled by your web app, then come back to this page.
Call the authorize method on the API object with an additional argument specifying the :oauth2_callback. This will bring the user to a consent screen.
In your callback method, call authorize again with the callback url, and the :oauth2_verification_code from the response, after the user granted access. Example code:
Store the user's token along with their ID in your database so you can retrieve it the next time they login to your system, so they do not have to re-grant authorization each time.