Step 7: Send authorize request
GET {{authPath}}/{{envID}}/as/authorize?client_id={{dvFlowAppID}}&response_type=code&response_mode=pi.flow&login_hint_token={{hint}}&scope=openid profile
This example shows the GET /{{envID}}/as/authorize operation to send an authorization request to the PingOne authorization server.
|
For authorization and flow requests, the PingOne endpoint domain is |
In this request:
-
{{envID}}represents your environment ID. -
response_typehere has a value ofcode. In other cases, it can betoken,id_token, or a combination of all three of these. -
client_idis the ID of the PingOne application that you created in a prior step. -
scopespecifies the OpenID Connect (OIDC) user claims are included in the token. -
response_mode. Set this topi.flowto allow the app to authenticate using the assigned flow policy without needing to handle HTTP redirections. -
login_hint_token. Setting this provides a way for the client to identify and authenticate the user.+ NOTE: In the Postman collection, this request includes a Postman pre-request script to create the
login_hint_tokenproperty value before executing the request.+
-
The request returns a
200message along with the JSON response from the DaVinci flow.
Example Request
-
cURL
-
C#
-
Go
-
HTTP
-
Java
-
jQuery
-
NodeJS
-
Python
-
PHP
-
Ruby
-
Swift
curl --location --globoff '{{authPath}}/{{envID}}/as/authorize?client_id={{dvFlowAppID}}&response_type=code&response_mode=pi.flow&login_hint_token={{hint}}&scope=openid%20profile'
var options = new RestClientOptions("{{authPath}}/{{envID}}/as/authorize?client_id={{dvFlowAppID}}&response_type=code&response_mode=pi.flow&login_hint_token={{hint}}&scope=openid profile")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("", Method.Get);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "{{authPath}}/{{envID}}/as/authorize?client_id={{dvFlowAppID}}&response_type=code&response_mode=pi.flow&login_hint_token={{hint}}&scope=openid%20profile"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
GET /{{envID}}/as/authorize?client_id={{dvFlowAppID}}&response_type=code&response_mode=pi.flow&login_hint_token={{hint}}&scope=openid profile HTTP/1.1
Host: {{authPath}}
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("{{authPath}}/{{envID}}/as/authorize?client_id={{dvFlowAppID}}&response_type=code&response_mode=pi.flow&login_hint_token={{hint}}&scope=openid profile")
.method("GET", body)
.build();
Response response = client.newCall(request).execute();
var settings = {
"url": "{{authPath}}/{{envID}}/as/authorize?client_id={{dvFlowAppID}}&response_type=code&response_mode=pi.flow&login_hint_token={{hint}}&scope=openid profile",
"method": "GET",
"timeout": 0,
};
$.ajax(settings).done(function (response) {
console.log(response);
});
var request = require('request');
var options = {
'method': 'GET',
'url': '{{authPath}}/{{envID}}/as/authorize?client_id={{dvFlowAppID}}&response_type=code&response_mode=pi.flow&login_hint_token={{hint}}&scope=openid profile',
'headers': {
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
url = "{{authPath}}/{{envID}}/as/authorize?client_id={{dvFlowAppID}}&response_type=code&response_mode=pi.flow&login_hint_token={{hint}}&scope=openid profile"
payload = {}
headers = {}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
<?php
require_once 'HTTP/Request2.php';
$request = new HTTP_Request2();
$request->setUrl('{{authPath}}/{{envID}}/as/authorize?client_id={{dvFlowAppID}}&response_type=code&response_mode=pi.flow&login_hint_token={{hint}}&scope=openid profile');
$request->setMethod(HTTP_Request2::METHOD_GET);
$request->setConfig(array(
'follow_redirects' => TRUE
));
try {
$response = $request->send();
if ($response->getStatus() == 200) {
echo $response->getBody();
}
else {
echo 'Unexpected HTTP status: ' . $response->getStatus() . ' ' .
$response->getReasonPhrase();
}
}
catch(HTTP_Request2_Exception $e) {
echo 'Error: ' . $e->getMessage();
}
require "uri"
require "net/http"
url = URI("{{authPath}}/{{envID}}/as/authorize?client_id={{dvFlowAppID}}&response_type=code&response_mode=pi.flow&login_hint_token={{hint}}&scope=openid profile")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body
var request = URLRequest(url: URL(string: "{{authPath}}/{{envID}}/as/authorize?client_id={{dvFlowAppID}}&response_type=code&response_mode=pi.flow&login_hint_token={{hint}}&scope=openid%20profile")!,timeoutInterval: Double.infinity)
request.httpMethod = "GET"
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data else {
print(String(describing: error))
return
}
print(String(data: data, encoding: .utf8)!)
}
task.resume()
Example Response
200 OK
{
"session": {
"id": "60420de9-9d38-44c5-a2a7-4839ded541f0"
},
"authorizeResponse": {
"code": "03796b0b-2fd1-4ae7-aed4-1e97f285a182"
"state": "39688168a2a3353be1f3c9378d12d89fa3353be1"
},
"environment": {
"id": "abfba8f6-49eb-49f5-a5d9-80ad5c98f9f6"
},
"status": "COMPLETED"
}