Help Center


Oauth API - Password flow

https://app.chaskiq.io/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBbXdEIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--827f2d0b5794f7bb660c48b79e228655bd857bed/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJYW5CbkJqb0dSVlE2RkhKbGMybDZaVjkwYjE5c2FXMXBkRnNIYVdscGFRPT0iLCJleHAiOm51bGwsInB1ciI6InZhcmlhdGlvbiJ9fQ==--cf24ea7784b3789671bb09c4029aca003c26b32d/me.jpg

Written by Miguel Michelson

updated

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.

Ruby example:

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.