Oauth API - Password flow
Written by Miguel Michelson
If you need to authorize the integration like a logged in user you will need to authorize the API access through password code.
To get the app_id and secret go to your chaskiq app and go to /oauth/applications.
There will be a default Application created.
app_id = "xxxx-app-id" secret = "xxxx-secret" url = "https://your-chaskiq-app" client = OAuth2::Client.new(app_id, secret, site: url ) access_token = client.password.get_token( params[:agent][:email], params[:agent][:password] ) access_token.to_json
access_token.to_json will provide the accessToken and the refreshToken to refresh the access when the accessToken has expired.