What authorization flows are supported by the Web API?
The OAuth 2.0 authorization protocol supports four distinct authorization flows, and their choice is very important for the type of application integrated. The choice of which flow type to use is made at the time of app creation. Used by mobile or web apps, which run on the client and as such cannot save the client secret. Used in machine-to-machine communications, scenarios where it is not necessary to give permissions to a particular user. Used by web applications that run on the server side. The following example demonstrates a use case of the Implict authorization flow for authorizing an application. Code for the client html page. Java code that will perform the request. Page styles.Implicit
Client credentials
Authorization code
Usage Example
'<!DOCTYPE html>
'<html>
'<head>
<title>Jasmin</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS & JS -->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<!-- Mystyle -->
<link href="main.css" rel="stylesheet" type="text/css" />
<!-- Our Website scripts -->
<script src="Index.js"></script>
'</head>
'<body>
<div class="container-fluid">
<div id="aligner">
<div class="text-center">
<div class="row">
<div class="col-md-12">
<h4><B>Demo OAuth 2.0</B></h4>
<p>Autenticação com fluxo implicito</p>
</div>
</div>
<div class="col-md-12">
<button onClick="doLogin()" class="btn btn-primary btn-block">Entrar</button>
</div>
</div>
</div>
</div>
'</body>
'</html>
function doLogin() {
var CLIENT_ID = 'A chave do seu cliente';
var AUTHORIZATION_ENDPOINT = 'https://identity.primaverabss.com/connect/authorize';
var CALLBACK_ENDPOINT = 'https://localhost:4200/login.html'
try {
var authUrl = AUTHORIZATION_ENDPOINT +
'?response_type=token' +
'&client_id=' + CLIENT_ID +
'&redirect_uri=' + CALLBACK_ENDPOINT +
'&scope=rose-api';
window.location.replace(authUrl);
}
catch (err) {
console.log(err.message);
}
}
#aligner {
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
}
#heading {
padding: 10px;
}
#main-content > .container {
padding: 0 15px;
}
login para deixar a sua opinião.