Skip to content
Website

(PKCE) Authorization code

In order to request the user to grant the access, you need to call Authorize. Browser window will be opened and user will be prompted for user name, password and grant the access of your application. Proper (same like you are using in your request) redirect uri needs to be configured in your accounts api settings.

GET/oauth/authorize

In order to request the user to grant the access, you need to call Authorize. Browser window will be opened and user will be prompted for user name, password and grant the access of your application. Proper (same like you are using in your request) redirect uri needs to be configured in your accounts api settings.

Query parameters

Name Example Description
client_id demo_identifier -
redirect_uri demo_identifier -
response_type code -
scope public -
code_challenge demo_identifier -
code_challenge_method S256 -

Code examples

cURL

curl --request GET 'https://app.datamolino.com/oauth/authorize?client_id=demo_identifier&redirect_uri=demo_identifier&response_type=code&scope=public&code_challenge=demo_identifier&code_challenge_method=S256'

HTTP

GET /oauth/authorize?client_id=demo_identifier&redirect_uri=demo_identifier&response_type=code&scope=public&code_challenge=demo_identifier&code_challenge_method=S256 HTTP/1.1
Host: app.datamolino.com

JavaScript Fetch

const response = await fetch("https://app.datamolino.com/oauth/authorize?client_id=demo_identifier&redirect_uri=demo_identifier&response_type=code&scope=public&code_challenge=demo_identifier&code_challenge_method=S256", {
  method: "GET",
  headers: {},
});

const data = await response.json();

Node.js Axios

import axios from "axios";

const response = await axios({
  method: "get",
  url: "https://app.datamolino.com/oauth/authorize?client_id=demo_identifier&redirect_uri=demo_identifier&response_type=code&scope=public&code_challenge=demo_identifier&code_challenge_method=S256",
  headers: {}
});

console.log(response.data);

Python Requests

import requests

url = "https://app.datamolino.com/oauth/authorize?client_id=demo_identifier&redirect_uri=demo_identifier&response_type=code&scope=public&code_challenge=demo_identifier&code_challenge_method=S256"
headers = {}

response = requests.request("GET", url, headers=headers)
response.raise_for_status()
print(response.json())

Ruby Net::HTTP

require 'json'
require 'net/http'

uri = URI("https://app.datamolino.com/oauth/authorize?client_id=demo_identifier&redirect_uri=demo_identifier&response_type=code&scope=public&code_challenge=demo_identifier&code_challenge_method=S256")
request = Net::HTTP::Get.new(uri)

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  http.request(request)
end

puts JSON.parse(response.body)

Ruby on Rails

# app/services/datamolino_client.rb
require 'json'
require 'net/http'

class DatamolinoClient
  BASE_URL = "https://app.datamolino.com"

  def initialize(access_token: Rails.application.credentials.dig(:datamolino, :access_token))
@access_token = access_token
  end

  def request_pkce_authorization_code
uri = URI("#{BASE_URL}/oauth/authorize?client_id=demo_identifier&redirect_uri=demo_identifier&response_type=code&scope=public&code_challenge=demo_identifier&code_challenge_method=S256")
request = Net::HTTP::Get.new(uri)

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
  http.request(request)
end

JSON.parse(response.body)
  end
end

PHP Guzzle

<?php

use GuzzleHttp\Client;

$client = new Client();
$response = $client->request('GET', 'https://app.datamolino.com/oauth/authorize?client_id=demo_identifier&redirect_uri=demo_identifier&response_type=code&scope=public&code_challenge=demo_identifier&code_challenge_method=S256', [
'headers' => json_decode('{}', true)
]);

echo $response->getBody();

Java OkHttp

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
.url("https://app.datamolino.com/oauth/authorize?client_id=demo_identifier&redirect_uri=demo_identifier&response_type=code&scope=public&code_challenge=demo_identifier&code_challenge_method=S256")
.method("GET", null)
.build();

Response response = client.newCall(request).execute();

C# HttpClient

using var client = new HttpClient();
using var request = new HttpRequestMessage(HttpMethod.Get, "https://app.datamolino.com/oauth/authorize?client_id=demo_identifier&redirect_uri=demo_identifier&response_type=code&scope=public&code_challenge=demo_identifier&code_challenge_method=S256");

using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

Go Native

client := &http.Client{}
req, err := http.NewRequest("GET", "https://app.datamolino.com/oauth/authorize?client_id=demo_identifier&redirect_uri=demo_identifier&response_type=code&scope=public&code_challenge=demo_identifier&code_challenge_method=S256", nil)
if err != nil { panic(err) }

res, err := client.Do(req)
if err != nil { panic(err) }
defer res.Body.Close()

body, err := io.ReadAll(res.Body)
if err != nil { panic(err) }
fmt.Println(string(body))

Swift URLSession

import Foundation

var request = URLRequest(url: URL(string: "https://app.datamolino.com/oauth/authorize?client_id=demo_identifier&redirect_uri=demo_identifier&response_type=code&scope=public&code_challenge=demo_identifier&code_challenge_method=S256")!)
request.httpMethod = "GET"

let (data, _) = try await URLSession.shared.data(for: request)
print(String(data: data, encoding: .utf8)!)

Responses

Authorization callback

Complete authorization in a browser. On success, read the authorization code from your registered callback URL, then exchange it at the (PKCE) access token endpoint. This step supplies a code through the redirect; it is not a JSON token response.

Type to search…

↑↓ navigate↵ selectEsc close