Help Center

Api clients - Auth Code flow

Written by Miguel Michelson


Chaskiq provides a Graphql API were you can query , create, update and delete campaings all the things that are provided in the admin inteface in which also consumes the same API. In order to consume and mutate Chaskiq data you'll need to authenticate your requests via Oauth2.

Create application

when you have logged into the Chaskiq panel , go to and create a new application. If your application will be consumed by native application in which not requires redirection callback you can use the urn:ietf:wg:oauth:2.0:oob value for callback.

Connect to application Example:

This is a ruby example in which you can connect to the API. The xxx values expect the proper app_id & secret generated on the oauth application you created in the previous step.

callback = "urn:ietf:wg:oauth:2.0:oob"

secret = "xxxxx-api-secret"

app_id = "xxxx-app_id"

client =, secret, site: "")

client.auth_code.authorize_url(redirect_uri: callback)

The last line will give you a url that you will need to visit in order to authorize the application.

 => ""

and you will get something like this:

Once you've authorized the integration the platform will provide the code to make authorized requests to the API

The authorization code is the grant access that you can use to retrieve a new access_token. The following is a Ruby example with the Oauth2 gem to retrieve the access_token:

require 'oauth2'

client =, client_secret, :site => 'http://localhost:3000')

client.auth_code.authorize_url(:redirect_uri => 'http://localhost:3000/callback')

token = client.auth_code.get_token(authorization_code_value, :redirect_uri => 'http://localhost:3000/callback')