How to get the token from a Ruby on Rails application?

I have an application that is made in Ruby on Rails, we are trying to use the REST API of infusionsoft to automate the creation of users, companies and relate them with events (TAGS).
We do not want to use the available gem because it is little supported.

To obtain the token, should I implement the OAUTH2 flow? Is there an example? In this case whenever a user enters my application should authorize infusionsoft? Thanks for answering my questions.

How to get the token from a Ruby on Rails application?

If you are making a single-instance application, you can walk the OAuth flow once yourself to generate a Refresh Token / Access Token, then maintain that in perpetuity to access that application’s data.

If you are making an application for consumers, you’ll need to use the OAuth flow for each user to access their data, and maintain the Refresh Tokens / Access Tokens of each.

https://developer.infusionsoft.com/getting-started-oauth-keys/

https://developer.infusionsoft.com/tutorials/making-oauth-requests-without-user-authorization/

TomScott Yes the applications is a single-intance, this is the client. I implement de flow all in the server side. But i have another question, i find in the documentation the Grant API access. Can I get the initial token and refresh token values in this form, and then continually check if token is expire and refresh it? I think that also save this values.
Am i in the correct ?

Thanks

No matter what language you develop in, the principals are the same, and I would recommend maintaining your access/refresh tokens for 24 hour refresh on a repeated cycle. (see vid for details)