<?xml 
version="1.0" encoding="utf-8"?>
<rss version="2.0" 
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
>

<channel xml:lang="fr">
	<title>OpenID Connect OAuth Server d&#233;di&#233; </title>
	<link>https://oa.dnc.global/</link>
	<description>OAuth Server by DnC (OAuthSD) est un serveur d'authentification qui impl&#233;mente OAuth 2.0 et OpenID Connect.
Avec la connexion unique, une entit&#233; permet aux utilisateurs de ses applications de naviguer de l'une &#224; l'autre de fa&#231;on trans-parente. En centralisant l'authentification des applications et des utilisateurs, un serveur OpenID Connect permet de contr&#244;ler parfaitement l'acc&#232;s des applications et des utilisateurs aux informations sensibles.</description>
	<language>fr</language>
	<generator>SPIP - www.spip.net</generator>

	<image>
		<title>&lt;small&gt;OpenID Connect&lt;/small&gt; OAuth Server &lt;small&gt; d&#233;di&#233; &lt;/small&gt;</title>
		<url>https://static.oa.dnc.global/local/cache-vignettes/L144xH126/siteon0-a21bf.png?1733820003</url>
		<link>https://oa.dnc.global/</link>
		<height>126</height>
		<width>144</width>
	</image>



<item xml:lang="fr">
		<title>Le jeton d'acc&#232;s peut &#234;tre un JWT sign&#233;</title>
		<link>https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html#lejetondaccespeutetreunjwtsigne</link>
		<guid isPermaLink="true">https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html#lejetondaccespeutetreunjwtsigne</guid>
		<dc:date>2019-06-16T11:23:00Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;La sp&#233;cification OAuth 2.0 est extr&#234;mement vague en ce qui concerne la forme que devrait avoir un jeton d'acc&#232;s. Voyez la discussion ici. &lt;br class='autobr' /&gt;
Le jeton d'acc&#232;s peut &#234;tre un JWT sign&#233; (ou comment r&#233;-inventer OpenID Connect) &lt;br class='autobr' /&gt;
La valeur true pour la constante de configuration USE_JWT_ACCESS_TOKENS provoque l'&#233;mission du jeton d'acc&#232;s sous la forme d'un JWT sign&#233;. &lt;br class='autobr' /&gt;
Voici ce qu'en dit Brent Shaffer : &lt;br class='autobr' /&gt; &#034;vous pouvez utiliser les jetons d'acc&#232;s JWT si vous avez des syst&#232;mes distribu&#233;s et que vous devez valider (...)&lt;/p&gt;


-
&lt;a href="https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html" rel="directory"&gt;Gestion du jeton d'acc&#232;s&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_texte'&gt;&lt;p&gt;La sp&#233;cification OAuth 2.0 est extr&#234;mement vague en ce qui concerne la forme que devrait avoir un jeton d'acc&#232;s. &lt;a href=&#034;https://stackoverflow.com/questions/29710783/may-an-oauth-2-0-access-token-be-a-jwt&#034; class='spip_out' rel='external'&gt;Voyez la discussion ici&lt;/a&gt;.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Le jeton d'acc&#232;s peut &#234;tre un JWT sign&#233; (ou comment r&#233;-inventer OpenID Connect)&lt;/h3&gt;
&lt;p&gt;La valeur true pour la constante de configuration USE_JWT_ACCESS_TOKENS provoque l'&#233;mission du jeton d'acc&#232;s sous la forme d'un JWT sign&#233;.&lt;/p&gt;
&lt;p&gt;Voici ce qu'en dit Brent Shaffer :&lt;/p&gt;
&lt;blockquote class=&#034;spip&#034;&gt;
&lt;p&gt; &#034;vous pouvez utiliser les jetons d'acc&#232;s JWT si vous avez des syst&#232;mes distribu&#233;s et que vous devez valider l'authenticit&#233; d'un jeton aupr&#232;s de plusieurs parties sans avoir &#224; passer un appel r&#233;seau.&lt;br class='autobr' /&gt;
Par exemple, un jeton est attribu&#233; par le serveur d'autorisations. Ce jeton est un jeton Web JSON sign&#233; par la cl&#233; priv&#233;e du serveur d'autorisations. Les serveurs de ressources (vers lesquels les appels d'API sont effectu&#233;s) sont r&#233;partis dans le monde entier et ex&#233;cutent plusieurs applications. Tant que les serveurs de ressources disposent de la cl&#233; publique du serveur d'autorisations, qui n'a pas besoin d'&#234;tre s&#233;curis&#233;e, ils peuvent valider les jetons rapidement sans aucun appel r&#233;seau. Les jetons n'ont m&#234;me pas besoin d'&#234;tre persist&#233;s.&#034;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Dans la mesure o&#249; nous avons OpenID Connect et le jeton d'identit&#233; au format JWT, cette facult&#233; ne parait pas essentielle. Les deux m&#233;thodes pr&#233;sentent l'inconv&#233;nient de ne pas permettre de v&#233;rifier l'actualit&#233; de la session OIDC.&lt;/p&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>Validation du jeton d'acc&#232;s avec la d&#233;claration at_hash du jeton d'identit&#233;</title>
		<link>https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html#validationdujetondaccesavecladeclarationat_hashdujetondidentite</link>
		<guid isPermaLink="true">https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html#validationdujetondaccesavecladeclarationat_hashdujetondidentite</guid>
		<dc:date>2018-12-01T11:01:47Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;Si le jeton d'ID contient une d&#233;claration at_hash, le client PEUT l'utiliser pour valider le jeton d'acc&#232;s. &lt;br class='autobr' /&gt;
Ceci est une pr&#233;caution de s&#233;curit&#233; utile (voire indispensable ?). En effet, nous disposons de la facult&#233; de v&#233;rifier le JWT avec sa signature, mais nous ne disposons pas de la facult&#233; de valider un jeton d'acc&#232;s de fa&#231;on autonome (puisque c'est un jeton opaque) &lt;br class='autobr' /&gt;
Encore un bon point pour OpenID Connect ! Un bon point aussi pour la biblioth&#232;que oauth2-server-php de Brent Schaffer qui ins&#232;re la (...)&lt;/p&gt;


-
&lt;a href="https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html" rel="directory"&gt;Gestion du jeton d'acc&#232;s&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_chapo'&gt;&lt;p&gt;Si le jeton d'ID contient une d&#233;claration at_hash, le client PEUT l'utiliser pour valider le jeton d'acc&#232;s.&lt;/p&gt;
&lt;p&gt;Ceci est une pr&#233;caution de s&#233;curit&#233; utile (voire indispensable ?). En effet, nous disposons de la facult&#233; de v&#233;rifier le JWT avec sa signature, mais nous ne disposons pas de la facult&#233; de valider un jeton d'acc&#232;s de fa&#231;on autonome (puisque c'est un jeton opaque)&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb1' class='spip_note' rel='appendix' title='Un argument souvent &#233;voqu&#233; pour justifier la n&#233;cessit&#233; de la v&#233;rification est (...)' id='nh1'&gt;1&lt;/a&gt;]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Encore un bon point pour OpenID Connect ! Un bon point aussi pour la biblioth&#232;que oauth2-server-php de Brent Schaffer qui ins&#232;re la d&#233;claration at_hash dans le jeton d'identit&#233;. Donc un bon point aussi pour OAuthSD.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;blockquote class=&#034;spip&#034;&gt;
&lt;p&gt;&lt;i&gt;Ce qui suit est une traduction d'extraits de &lt;a href=&#034;http://openid.net/specs/openid-connect-core-1_0.html&#034; class='spip_out' rel='external'&gt;OpenID Connect Core 1.0&lt;/a&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3.1.3.8. Validation du jeton d'acc&#232;s&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Lors de l'utilisation du flux de code d'autorisation&lt;/strong&gt;, si le jeton d'ID contient une d&#233;claration at_hash, le client PEUT l'utiliser pour valider le jeton d'acc&#232;s de la m&#234;me mani&#232;re que pour le flux implicite, tel que d&#233;fini dans la section 3.2.2.9, Jeton d'acc&#232;s renvoy&#233; &#224; partir du point d'extr&#233;mit&#233; Token.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3.2.2.9. Validation du jeton d'acc&#232;s&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Pour valider un jeton d'acc&#232;s &#233;mis &#224; partir du point d'extr&#233;mit&#233; d'autorisation avec un jeton d'ID, le client DOIT faire ce qui suit :&lt;/p&gt;
&lt;p&gt; - Hash les octets de la repr&#233;sentation ASCII de l'access_token avec l'algorithme de hachage sp&#233;cifi&#233; dans JWA pour le param&#232;tre Alg Header de l'en-t&#234;te JOSE de Token ID. Par exemple, si l'alg est RS256, l'algorithme de hachage utilis&#233; est SHA-256.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Prendre la moiti&#233; la plus &#224; gauche du hachage et base64url encoder.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; La valeur de at_hash dans le jeton d'identification DOIT correspondre &#224; la valeur produite &#224; l'&#233;tape pr&#233;c&#233;dente.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Exemple de code :&lt;br class='autobr' /&gt;
&lt;strong&gt;PHP&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_php code&#034;&gt;&lt;div class=&#034;php&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;@&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$jwt&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'at_hash'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Verify access token&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$hash&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/hash&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;hash&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'sha256'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$access_token&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$ath&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/substr&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;substr&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$hash&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;0&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;a href=&#034;http://www.php.net/strlen&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;strlen&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$hash&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;/&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;2&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$encryptionUtil&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000000; font-weight: bold;&#034;&gt;new&lt;/span&gt; \OAuth2\Encryption\Jwt&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$ath&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$encryptionUtil&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;-&gt;&lt;/span&gt;&lt;span style=&#034;color: #004000;&#034;&gt;urlSafeB64Encode&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$ath&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$ath&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;!==&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$jwt&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'at_hash'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Token request error&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/exit&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;exit&lt;/span&gt;&lt;/a&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'Access Token not valid'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://static.oa.dnc.global/local/cache-code/67461ccf171bdef7d2823a82ff4e5d62.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Note :&lt;/strong&gt; &lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Dans l'&#233;tat actuel du d&#233;veloppement, le flux Authorization Code d'OpenID Connect ne comporte la d&#233;claration at_hash que dans le cadre du flux Implicit (type de r&#233;ponse 'idtoken token'). La g&#233;n&#233;ralisation de at_hash est &#224; l'&#233;tude. Voyez : &lt;a href=&#034;https://github.com/bshaffer/oauth2-server-php-docs/issues/113&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;https://github.com/bshaffer/oauth2-server-php-docs/issues/113&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
		&lt;hr /&gt;
		&lt;div class='rss_notes'&gt;&lt;div id='nb1'&gt;
&lt;p&gt;&lt;span class=&#034;spip_note_ref&#034;&gt;[&lt;a href='#nh1' class='spip_note' title='Notes 1' rev='appendix'&gt;1&lt;/a&gt;] &lt;/span&gt;Un argument souvent &#233;voqu&#233; pour justifier la n&#233;cessit&#233; de la v&#233;rification est que le jeton d'acc&#232;s et le jeton d'identit&#233; ne sont pas coupl&#233;s strictement.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>Rafra&#238;chir (actualiser) un jeton d'acc&#232;s</title>
		<link>https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html#rafraichiractualiserunjetondacces</link>
		<guid isPermaLink="true">https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html#rafraichiractualiserunjetondacces</guid>
		<dc:date>2018-11-29T09:10:00Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;Le rafra&#238;chissement (ou l'actualisation) d'un jeton d'acc&#232;s (Access Token Refresh) permet &#224; une application cliente d'en prolonger la validit&#233;. La demande est faite au Point d'extr&#233;mit&#233; de jeton (Token Endpoint) en mentionnant le type de flux &#034;refresh_token&#034;. &lt;br class='autobr' /&gt;
Les jetons de rafra&#238;chissement ne sont fournis (et le sont alors syst&#233;matiquement) que lors de la r&#233;cup&#233;ration d'un jeton avec les flux Autorisation via un code (Authorization Code Grant) et Autorisation via un mot de passe (User Credentials, (...)&lt;/p&gt;


-
&lt;a href="https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html" rel="directory"&gt;Gestion du jeton d'acc&#232;s&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_chapo'&gt;&lt;p&gt;Le rafra&#238;chissement (ou l'actualisation) d'un jeton d'acc&#232;s (Access Token Refresh) permet &#224; une application cliente d'en prolonger la validit&#233;. La demande est faite au Point d'extr&#233;mit&#233; de jeton (Token Endpoint) en mentionnant le type de flux &#034;refresh_token&#034;.&lt;/p&gt;
&lt;p&gt;Les jetons de rafra&#238;chissement ne sont fournis (et le sont alors syst&#233;matiquement) que lors de la r&#233;cup&#233;ration d'un jeton avec les flux Autorisation via un code (Authorization Code Grant) et Autorisation via un mot de passe (User Credentials, Resource Owner Password Credentials Grant).&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;p&gt;Avertissement : Une mauvaise utilisation du jeton de rafra&#238;chissement peut faire perdre tout le b&#233;n&#233;fice de s&#233;curit&#233; d'OpenID Connect. Voir in fine : &#034;Bonnes pratiques pour la s&#233;curit&#233;&#034;.&lt;/p&gt;
&lt;p&gt;Note : cet article s'applique aussi bien &#224; OpenID Connect qu'&#224; OAuth 2.0.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Forme de la demande de rafra&#238;chissement d'un jeton d'acc&#232;s&lt;/h3&gt;
&lt;p&gt;La demande ne doit &#234;tre effectu&#233;e que par la m&#233;thode POST.&lt;br class='autobr' /&gt;
Les param&#232;tres suivants doivent &#234;tre post&#233;s :
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; grant_type : &#034;refresh_token&#034;.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; refresh_token : le code de rafra&#238;chissement re&#231;u avec le jeton d'acc&#232;s.&lt;/p&gt;
&lt;p&gt;Le client doit s'authentifier selon l'une des deux m&#233;thodes suivantes :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. HTTP Basic Authentication (client_secret_basic)&lt;/strong&gt;&lt;br class='autobr' /&gt;
Le client doit s'identifier en passant ses identifiants dans une ent&#234;te Authorization.&lt;br class='autobr' /&gt;
Exemple avec PHP cUrl :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PHP&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_php code&#034;&gt;&lt;div class=&#034;php&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Identification du client avec HTTP Basic Authentication :&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$data&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'grant_type'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'refresh_token'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'refresh_token'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$refresh_token&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/curl_init&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_init&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$token_endpoint&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_RETURNTRANSFER&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;true&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_TIMEOUT&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;10&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_POST&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;true&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_USERPWD&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;&lt;span style=&#034;color: #006699; font-weight: bold;&#034;&gt;{$client_id}&lt;/span&gt;:&lt;span style=&#034;color: #006699; font-weight: bold;&#034;&gt;{$client_secret}&lt;/span&gt;&#034;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_SSL_VERIFYPEER&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;false&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_HTTPHEADER&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;a href=&#034;http://www.php.net/array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'Content-Type: application/x-www-form-urlencoded'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_POSTFIELDS&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;a href=&#034;http://www.php.net/http_build_query&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;http_build_query&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$data&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$res&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/curl_exec&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_exec&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;a href=&#034;http://www.php.net/is_array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;is_array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;a href=&#034;http://www.php.net/json_decode&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;json_decode&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$res&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;true&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/curl_close&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_close&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$h&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$res&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/json_decode&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;json_decode&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$res&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;true&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://static.oa.dnc.global/local/cache-code/e8ebb6a1494155882ab9b9d458ec8aab.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;2. Identifiants dans le corps de la demande (client_secret_post)&lt;/strong&gt;&lt;br class='autobr' /&gt;
Les informations d'identification du client doivent &#234;tre post&#233;s :
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; client_id : l'ID de l'application cliente.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; client_secret : le secret de l'application cliente.&lt;br class='autobr' /&gt;
Les valeurs donn&#233;es pour les param&#232;tres client_id et client_secret doivent correspondre aux valeurs d&#233;finies lors de l'inscription de l'application cliente sur le serveur.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;R&#233;ponse du serveur&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;En cas de succ&#232;s&lt;/strong&gt;, le serveur retourne une r&#233;ponse HTTP 200.&lt;/p&gt;
&lt;p&gt;Le corps de la r&#233;ponse contient un tableau portant les informations suivantes :&lt;/p&gt;
&lt;table class=&#034;spip&#034;&gt;
&lt;thead&gt;&lt;tr class='row_first'&gt;&lt;th id='id2400_c0'&gt; index &lt;/th&gt;&lt;th id='id2400_c1'&gt; type &lt;/th&gt;&lt;th id='id2400_c2'&gt; valeur &lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td headers='id2400_c0'&gt;page&lt;/td&gt;
&lt;td headers='id2400_c1'&gt;JSON array&lt;/td&gt;
&lt;td headers='id2400_c2'&gt;access_token : jeton d'acc&#232;s&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Le Header comporte, comme il se doit, la directive 'Cache-Control : no-cache, no-store'.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;En cas d'&#233;chec&lt;/strong&gt;, le corps de la r&#233;ponse contient :&lt;/p&gt;
&lt;table class=&#034;spip&#034;&gt;
&lt;thead&gt;&lt;tr class='row_first'&gt;&lt;th id='id0886_c0'&gt; index &lt;/th&gt;&lt;th id='id0886_c1'&gt; type &lt;/th&gt;&lt;th id='id0886_c2'&gt; valeur &lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td headers='id0886_c0'&gt;page&lt;/td&gt;
&lt;td headers='id0886_c1'&gt;JSON Array&lt;/td&gt;
&lt;td headers='id0886_c2'&gt;error : titre de l'erreur,&lt;br class='autobr' /&gt;
error_description : description de l'erreur&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;La r&#233;ponse HTTP ainsi que les valeurs de error et error_description sont donn&#233;es par le tableau suivant :&lt;/p&gt;
&lt;table class=&#034;spip&#034;&gt;
&lt;tbody&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;&lt;strong&gt;R&#233;ponse&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;error&lt;br class='autobr' /&gt;
titre de l'erreur&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;error_description&lt;br class='autobr' /&gt;
description de l'erreur&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Explication&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_request&lt;/td&gt;
&lt;td&gt;Missing parameter : &#034;refresh_token&#034; is required&lt;/td&gt;
&lt;td&gt;Param&#232;tre manquant : &#034;refresh_token&#034; est attendu&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_grant&lt;/td&gt;
&lt;td&gt;Invalid refresh token&lt;/td&gt;
&lt;td&gt;Jeton de rafra&#238;chissement non valide&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_grant&lt;/td&gt;
&lt;td&gt;Refresh token has expired&lt;/td&gt;
&lt;td&gt;Le jeton de rafra&#238;chissement a expir&#233;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Ainsi que quelques autres r&#233;ponses identiques &#224; la demande d'un jeton d'acc&#232;s.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Exemple de code&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;SPIP&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_php code&#034;&gt;&lt;div class=&#034;php&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #339933;&#034;&gt;...&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Rafra&#238;chir le jeton expir&#233; &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$options&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'methode'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'POST'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'datas'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;a href=&#034;http://www.php.net/array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'grant_type'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'refresh_token'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'refresh_token'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$_SESSION&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'oauth_refresh_token'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'client_id'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'XXXXX'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'client_secret'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'XXXXXXXXXXXXXX'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$url&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;http://oa.dnc.global/oauth/token.php&#034;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$refresh_response&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; recuperer_url&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$url&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$options&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$refresh_status&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;int&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$refresh_response&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'status'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$refresh_status&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;200&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$_SESSION&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'oauth_access_token'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$refresh_response&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'access_token'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;true&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;else&lt;/span&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;false&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #339933;&#034;&gt;...&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://static.oa.dnc.global/local/cache-code/34bbd164978ce78cc7a337935bba1c8d.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Attention :&lt;/strong&gt;&lt;br class='autobr' /&gt;
Pour pouvoir rafra&#238;chir un jeton d'acc&#232;s, l'application cliente doit avoir &#233;t&#233; inscrite avec le Grant Type &#034;Refresh Token&#034; :&lt;/p&gt;
&lt;p&gt;&lt;span class='spip_document_10 spip_documents spip_documents_center'&gt;
&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L500xH215/refresh_grant_type-46396.png?1734010432' width='500' height='215' alt=&#034;&#034; /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Bonnes pratiques pour la s&#233;curit&#233;&lt;/h3&gt;
&lt;p&gt;Le jeton d'actualisation permet &#224; l'application de demander au serveur d'&#233;mettre directement un nouveau jeton d'acc&#232;s et/ou un nouveau jeton d'identification, sans avoir &#224; authentifier &#224; nouveau l'utilisateur. Cela fonctionnera tant que le jeton d'actualisation n'a pas &#233;t&#233; r&#233;voqu&#233;.&lt;/p&gt;
&lt;p&gt;On comprendra qu'il convient de n'utiliser ce jeton que dans une relation serveur-serveur (back channel). C'est pourquoi l'obtention d'un jeton d'actualisation n'est possible qu'avec les flux Autorisation avec Code (Authorization Code Grant) ou Autorisation via mot de passe (User Credentials, Resource Owner Password Credentials Grant)&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb3-1' class='spip_note' rel='appendix' title='Dans la liste d&#233;roulante, OAuthSD pr&#233;sente la possibilit&#233; d'utiliser le jeton (...)' id='nh3-1'&gt;1&lt;/a&gt;]&lt;/span&gt; .&lt;/p&gt;
&lt;p&gt;Dand le cadre d'OpenID Connect, OAuthSD ne fournira le jeton d'actualisation que si la demande de port&#233;e (scope) &lt;a href='https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html#offlineaccess' class='spip_in'&gt;offline_access&lt;/a&gt; a &#233;t&#233; pr&#233;d&#233;finie pour l'application cliente, est demand&#233;e dans la requ&#234;te et a &#233;t&#233; accept&#233;e par l'utilisateur final.&lt;/p&gt;
&lt;p&gt;Compte tenu notamment de la n&#233;cessit&#233; de transmettre le param&#232;tre client_secret, il est indispensable que l'application cliente stocke et transmette ce jeton de fa&#231;on la plus s&#233;curis&#233;e possible. Il convient d'&lt;strong&gt;appliquer les bonnes pratiques&lt;/strong&gt; suivantes au jeton de rafra&#238;chissement&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb3-2' class='spip_note' rel='appendix' title='Ainsi qu'aux autres jetons !' id='nh3-2'&gt;2&lt;/a&gt;]&lt;/span&gt;, sous peine de d&#233;truire la s&#233;curit&#233; des flux consid&#233;r&#233;s :
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; le jeton de rafra&#238;chissement ne doit pas &#234;tre enregistr&#233; dans un cookie ;
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; le jeton de rafra&#238;chissement ne doit pas &#234;tre pass&#233; en param&#232;tre d'URL ;
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; le jeton de rafra&#238;chissement ne doit pas &#234;tre envoy&#233; depuis l'user-agent, c'est &#224; dire dans le canal visible (front channel) par exemple &#224; l'aide de code Javascript.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; ... ?&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Notre avis sur le rafra&#238;chissement&lt;/h3&gt;
&lt;p&gt;Avec le m&#233;canisme SLI, OAuthSD permet de tout faire avec le flux le plus s&#233;curis&#233; : Autorisation via un code (Authorization code grant). En particulier, &lt;strong&gt;OAuthSD permet de rafra&#238;chir les jetons &#224; l'aide de la r&#233;-authentification silencieuse&lt;/strong&gt; (Silent R&#233;-authentication, SRA) qui offre toutes les garanties de s&#233;curit&#233;. Une application en est donn&#233;e ici : &lt;a href='https://static.oa.dnc.global/-OpenID-Connect-SSO-management-de-session-etc-.html#avertirdelafindesessionoidcetlaprolonger' class='spip_in'&gt;Avertir de la fin de session OIDC et la prolonger&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
		&lt;hr /&gt;
		&lt;div class='rss_notes'&gt;&lt;div id='nb3-1'&gt;
&lt;p&gt;&lt;span class=&#034;spip_note_ref&#034;&gt;[&lt;a href='#nh3-1' class='spip_note' title='Notes 3-1' rev='appendix'&gt;1&lt;/a&gt;] &lt;/span&gt;Dans la liste d&#233;roulante, OAuthSD pr&#233;sente la possibilit&#233; d'utiliser le jeton de rafra&#238;chisement conjointement &#224; tous les flux ; bien entendu cela ne fonctionnera que pour les &#034;bons&#034; flux.&lt;/p&gt;
&lt;/div&gt;&lt;div id='nb3-2'&gt;
&lt;p&gt;&lt;span class=&#034;spip_note_ref&#034;&gt;[&lt;a href='#nh3-2' class='spip_note' title='Notes 3-2' rev='appendix'&gt;2&lt;/a&gt;] &lt;/span&gt;Ainsi qu'aux autres jetons !&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>R&#233;voquer un jeton</title>
		<link>https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html#revoquerunjeton</link>
		<guid isPermaLink="true">https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html#revoquerunjeton</guid>
		<dc:date>2016-11-12T17:59:29Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;Le sujet est couvert par le document RFC 7009 OAuth 2.0 Token Revocation.
&lt;br class='autobr' /&gt;
Ce document propose un point d'extr&#233;mit&#233; suppl&#233;mentaire pour le serveur d'autorisation OAuth, qui permet aux clients d'avertir le serveur d'autorisation qu'un jeton de rafra&#238;chissement ou d'acc&#232;s pr&#233;c&#233;demment obtenu n'est plus n&#233;cessaire. Cela permet au serveur d'autorisation de nettoyer les donn&#233;es de s&#233;curit&#233;. Une demande de r&#233;vocation invalidera le jeton en question et, le cas &#233;ch&#233;ant, d'autres jetons bas&#233;s sur la m&#234;me autorisation. (...)&lt;/p&gt;


-
&lt;a href="https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html" rel="directory"&gt;Gestion du jeton d'acc&#232;s&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_chapo'&gt;&lt;p&gt;Le sujet est couvert par le document &lt;a href=&#034;https://tools.ietf.org/html/rfc7009&#034; class='spip_out' rel='external'&gt;RFC 7009&lt;/a&gt; OAuth 2.0 Token Revocation.&lt;br class='autobr' /&gt;
Ce document propose un point d'extr&#233;mit&#233; suppl&#233;mentaire pour le serveur d'autorisation OAuth, qui permet aux clients d'avertir le serveur d'autorisation qu'un jeton de rafra&#238;chissement ou d'acc&#232;s pr&#233;c&#233;demment obtenu n'est plus n&#233;cessaire. Cela permet au serveur d'autorisation de nettoyer les donn&#233;es de s&#233;curit&#233;. Une demande de r&#233;vocation invalidera le jeton en question et, le cas &#233;ch&#233;ant, d'autres jetons bas&#233;s sur la m&#234;me autorisation.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;h3 class=&#034;spip&#034;&gt;Point d'extr&#233;mit&#233; de R&#233;vocation&lt;/h3&gt;
&lt;p&gt;OAuth Server by DnC expose le point de terminaison 'revoke' pour la r&#233;vocation d'un jeton d'acc&#232;s ou de rafra&#238;chissement :&lt;/p&gt;
&lt;p&gt;&lt;code class='spip_code' dir='ltr'&gt;https://oa.dnc.global/oauth/revoke.php&lt;/code&gt;&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Forme de la demande de R&#233;vocation&lt;/h3&gt;
&lt;p&gt;La demande ne doit &#234;tre effectu&#233;e que par la m&#233;thode POST.&lt;br class='autobr' /&gt;
Les param&#232;tres suivants doivent &#234;tre post&#233;s :
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; token (obligatoire)
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; token_type_hint (optionnel) : 'access_token' ou 'refresh_token'. Peut &#234;tre manquant ou m&#234;me erron&#233;, le serveur recherchera le token parmi tous les types possibles.&lt;/p&gt;
&lt;p&gt;Le client inclut &#233;galement ses informations d'authentification telles que d&#233;crites &#224; la section 2.3. du document [RFC6749].&lt;/p&gt;
&lt;p&gt;Exemple de requ&#234;te :&lt;/p&gt;
&lt;div style='text-align: left;' class='spip_code' dir='ltr'&gt;&lt;code&gt;POST /revoke HTTP/1.1&lt;br /&gt; Host: oa.dnc.global&lt;br /&gt; Content-Type: application/x-www-form-urlencoded&lt;br /&gt; Authorization: Basic czZCaGRSa3F0MzpnWDFmQmF0M2JW&lt;br /&gt; &lt;br /&gt; token=45ghiukldjahdnhzdauz&amp;token_type_hint=refresh_token&lt;/code&gt;&lt;/div&gt;&lt;h3 class=&#034;spip&#034;&gt;R&#233;ponse&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;En cas de succ&#232;s&lt;/strong&gt; ou &lt;strong&gt;si le jeton est invalide&lt;/strong&gt;, le serveur retourne une r&#233;ponse HTTP 200.&lt;/p&gt;
&lt;p&gt;Remarque : les jetons non valides ne provoquent pas de r&#233;ponse d'erreur puisque l'objet de la demande de r&#233;vocation, invalider le jeton d&#233;sign&#233;, est d&#233;j&#224; atteint.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;En cas d'&#233;chec&lt;/strong&gt;, le corps de la r&#233;ponse contient :&lt;/p&gt;
&lt;table class=&#034;spip&#034;&gt;
&lt;thead&gt;&lt;tr class='row_first'&gt;&lt;th id='id9a22_c0'&gt; index &lt;/th&gt;&lt;th id='id9a22_c1'&gt; type &lt;/th&gt;&lt;th id='id9a22_c2'&gt; valeur &lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td headers='id9a22_c0'&gt;page&lt;/td&gt;
&lt;td headers='id9a22_c1'&gt;JSON Array&lt;/td&gt;
&lt;td headers='id9a22_c2'&gt;error : titre de l'erreur,&lt;br class='autobr' /&gt;
error_description : description de l'erreur&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;La r&#233;ponse HTTP ainsi que les valeurs de error et error_description sont donn&#233;es par le tableau suivant :&lt;/p&gt;
&lt;table class=&#034;spip&#034;&gt;
&lt;tbody&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;&lt;strong&gt;R&#233;ponse&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;error&lt;br class='autobr' /&gt;
titre de l'erreur&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;error_description&lt;br class='autobr' /&gt;
description de l'erreur&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Explication&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_request&lt;/td&gt;
&lt;td&gt;The request method must be POST when revoking an access token&lt;/td&gt;
&lt;td&gt;La m&#233;thode de la demande doit &#234;tre POST lorsque vous r&#233;voquez un jeton d'acc&#232;s&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_request&lt;/td&gt;
&lt;td&gt;Token type hint must be either &#034;access_token&#034; or &#034;refresh_token&#034;&lt;/td&gt;
&lt;td&gt;Le type de jeton doit &#234;tre &#034;access_token&#034; ou &#034;refresh_token&#034;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_request&lt;/td&gt;
&lt;td&gt;Missing token parameter to revoke&lt;/td&gt;
&lt;td&gt;Il manque le type du jeton &#224; r&#233;voquer&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>OAuth 2.0 : Obtenir un jeton d'acc&#232;s</title>
		<link>https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html#oauth20obtenirunjetondacces</link>
		<guid isPermaLink="true">https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html#oauth20obtenirunjetondacces</guid>
		<dc:date>2016-11-05T10:31:12Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;L'application cliente doit disposer d'un jeton d'acc&#232;s pour obtenir des donn&#233;es prot&#233;g&#233;es de la part d'un serveur de ressources. &lt;br class='autobr' /&gt;
Au pr&#233;alable, l'application doit avoir obtenu un jeton d'autorisation aupr&#232;s du serveur (point de terminaison authorize). &lt;br class='autobr' /&gt;
Le code n&#233;cessaire est enti&#232;rement &#224; la charge de l'auteur de l'application cliente, en r&#233;action &#224; la redirection sur l'URI du point d'extr&#233;mit&#233; de redirection. La m&#233;thode d&#233;pend du flux d'autorisation : avec Authorization Code Grant, l'application cliente doit (...)&lt;/p&gt;


-
&lt;a href="https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html" rel="directory"&gt;Gestion du jeton d'acc&#232;s&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_chapo'&gt;&lt;p&gt;L'application cliente doit disposer d'un jeton d'acc&#232;s pour obtenir des donn&#233;es prot&#233;g&#233;es de la part d'un serveur de ressources.&lt;/p&gt;
&lt;p&gt;Au pr&#233;alable, l'application doit avoir obtenu un jeton d'autorisation aupr&#232;s du serveur (point de terminaison authorize).&lt;/p&gt;
&lt;p&gt;Le code n&#233;cessaire est enti&#232;rement &#224; la charge de l'auteur de l'application cliente, en r&#233;action &#224; la redirection sur l'URI du point d'extr&#233;mit&#233; de redirection. La m&#233;thode d&#233;pend du flux d'autorisation : avec Authorization Code Grant, l'application cliente doit d'abord obtenir un code d'autorisation.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;h3 class=&#034;spip&#034;&gt;Point d'extr&#233;mit&#233; de jeton (Token Endpoint)&lt;/h3&gt;
&lt;p&gt;&lt;code class='spip_code' dir='ltr'&gt;https://oa.dnc.global/oauth/token.php&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Le point d'extr&#233;mit&#233; de jeton est le point d'extr&#233;mit&#233; sur le serveur d'autorisation auquel s'adresse l'application cliente avec le code d'autorisation, l'ID client et le secret, pour obtenir un jeton d'acc&#232;s.&lt;/p&gt;
&lt;p&gt;C'est &#233;galement &#224; ce point qu'une application s'adresse pour &lt;a href='https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html#rafraichiractualiserunjetondacces' class='spip_in'&gt;Rafra&#238;chir (actualiser) un jeton d'acc&#232;s&lt;/a&gt;.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Forme de la demande de jeton d'acc&#232;s&lt;/h3&gt;
&lt;p&gt;La demande ne doit &#234;tre effectu&#233;e que par la m&#233;thode POST.&lt;br class='autobr' /&gt;
Les param&#232;tres suivants doivent &#234;tre post&#233;s :
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; grant_type : Type de flux d'autorisation, par exemple &#034;authorization_code&#034;.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; code : le code d'autorisation re&#231;u.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; client_id : l'ID de l'application cliente.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; client_secret : le secret de l'application cliente.&lt;/p&gt;
&lt;p&gt;Le client inclut &#233;galement ses informations d'authentification telles que d&#233;crites &#224; la section 2.3. du document [RFC6749].&lt;/p&gt;
&lt;p&gt;Les valeurs donn&#233;es pour les param&#232;tres grant_type, client_id et client_secret doivent correspondre aux valeurs d&#233;finies lors de l'inscription de l'application cliente sur le serveur.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Notes :&lt;/strong&gt;
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Il existe une fa&#231;on de demander un jeton sans transmetre les identifiants de l'application cliente : &lt;a href='https://static.oa.dnc.global/-Autorisation-porteuse-de-JWT-JWT-Bearer-Authorization-Grant-.html#demandedautorisationavecjwtjwtbearerauthorizationgrant' class='spip_in'&gt;Demande d'autorisation avec JWT (JWT Bearer Authorization Grant)&lt;/a&gt;.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;R&#233;ponse du serveur&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;En cas de succ&#232;s&lt;/strong&gt;, le serveur retourne une r&#233;ponse HTTP 200.&lt;/p&gt;
&lt;p&gt;Le corps de la r&#233;ponse contient un tableau portant les informations suivantes :&lt;/p&gt;
&lt;table class=&#034;spip&#034;&gt;
&lt;thead&gt;&lt;tr class='row_first'&gt;&lt;th id='id2400_c0'&gt; index &lt;/th&gt;&lt;th id='id2400_c1'&gt; type &lt;/th&gt;&lt;th id='id2400_c2'&gt; valeur &lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td headers='id2400_c0'&gt;page&lt;/td&gt;
&lt;td headers='id2400_c1'&gt;JSON array&lt;/td&gt;
&lt;td headers='id2400_c2'&gt;access_token : jeton d'acc&#232;s&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;Le Header comporte, comme il se doit, la directive 'Cache-Control : no-cache, no-store'.&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;En cas d'&#233;chec&lt;/strong&gt;, le corps de la r&#233;ponse contient :&lt;/p&gt;
&lt;table class=&#034;spip&#034;&gt;
&lt;thead&gt;&lt;tr class='row_first'&gt;&lt;th id='id0886_c0'&gt; index &lt;/th&gt;&lt;th id='id0886_c1'&gt; type &lt;/th&gt;&lt;th id='id0886_c2'&gt; valeur &lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td headers='id0886_c0'&gt;page&lt;/td&gt;
&lt;td headers='id0886_c1'&gt;JSON Array&lt;/td&gt;
&lt;td headers='id0886_c2'&gt;error : titre de l'erreur,&lt;br class='autobr' /&gt;
error_description : description de l'erreur&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;La r&#233;ponse HTTP ainsi que les valeurs de error et error_description sont donn&#233;es par le tableau suivant :&lt;/p&gt;
&lt;table class=&#034;spip&#034;&gt;
&lt;tbody&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;&lt;strong&gt;R&#233;ponse&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;error&lt;br class='autobr' /&gt;
titre de l'erreur&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;error_description&lt;br class='autobr' /&gt;
description de l'erreur&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Explication&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;405&lt;/td&gt;
&lt;td&gt;invalid_request&lt;/td&gt;
&lt;td&gt;The request method must be POST when requesting an access token&lt;/td&gt;
&lt;td&gt;La m&#233;thode de la demande doit &#234;tre POST lorsque vous demandez un jeton d'acc&#232;s. Notez que le Header contient 'Allow : POST'&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_request&lt;/td&gt;
&lt;td&gt;The grant type was not specified in the request&lt;/td&gt;
&lt;td&gt;Le &lt;a href='https://static.oa.dnc.global/-OAuth-2-0-.html#oauth20lestypesdautorisationgranttype' class='spip_in'&gt;type d'autorisation&lt;/a&gt; n'a pas &#233;t&#233; sp&#233;cifi&#233; dans la demande&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;unsupported_grant_type&lt;/td&gt;
&lt;td&gt;Grant type &#034;X&#034; not supported&lt;/td&gt;
&lt;td&gt;Le Type d'autorisation &#034;X&#034; n'est pas support&#233;.&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_grant&lt;/td&gt;
&lt;td&gt;X doesn\'t exist or is invalid for the client&lt;/td&gt;
&lt;td&gt;Le type d'autorisation indiqu&#233; n'existe pas ou est invalide pour le client&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;unauthorized_client&lt;/td&gt;
&lt;td&gt;The grant type is unauthorized for this client_id&lt;/td&gt;
&lt;td&gt;Le type d'autorisation n'est pas autoris&#233; pour ce client_id&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_scope&lt;/td&gt;
&lt;td&gt;The scope requested is invalid for this request&lt;/td&gt;
&lt;td&gt;La &lt;a href='https://static.oa.dnc.global/-Sujets-communs-a-Oauth-2-et-OpenID-Connect-.html#porteedelautorisationscope' class='spip_in'&gt;port&#233;e d'autorisation&lt;/a&gt; demand&#233;e est invalide pour cette demande&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_scope&lt;/td&gt;
&lt;td&gt;The scope requested is invalid for this client&lt;/td&gt;
&lt;td&gt;La port&#233;e d'autorisation demand&#233;e est valide pour ce client&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_scope&lt;/td&gt;
&lt;td&gt;An unsupported scope was requested&lt;/td&gt;
&lt;td&gt;La port&#233;e d'autorisation demand&#233;e n'est pas support&#233;e&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;h3 class=&#034;spip&#034;&gt;Exemples de code&lt;/h3&gt;
&lt;p&gt;Donn&#233;es de la requ&#234;te :
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; $AuthCode est le code d'autorisation obtenu &#224; l'&#233;tape pr&#233;c&#233;dente et transmis &#224; la page de CallBack
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; $client_id, $client_secret : Comme indiqu&#233; lors de l'inscription de l'application cliente sur le serveur d'autorisation.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;PHP&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_php code&#034;&gt;&lt;div class=&#034;php&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Demander un jeton d'acc&#232;s pour l'application&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$jeton&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;''&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$url&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'https://oa.dnc.global/oauth/token.php'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$datas&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'grant_type'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'authorization_code'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'code'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$AuthCode&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'client_id'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'XXXXXX'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'client_secret'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'XXXXXXXXXXX'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$ch&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/curl_init&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_init&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$ch&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_URL&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$url&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$ch&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_POST&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;true&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$ch&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_POSTFIELDS&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$datas&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$ch&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_RETURNTRANSFER&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;true&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$ch&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_HEADER&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;false&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$ch&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_TIMEOUT&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;30&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/curl_setopt&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_setopt&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$ch&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; CURLOPT_SSL_VERIFYPEER&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;false&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$result_json&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/curl_exec&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_exec&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$ch&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$result&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/json_decode&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;json_decode&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$result_json&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;true&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$token&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$result&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'access_token'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/curl_close&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;curl_close&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$ch&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://static.oa.dnc.global/local/cache-code/cb59bcfa2ae4599ab3abe88440337440.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;SPIP&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_php code&#034;&gt;&lt;div class=&#034;php&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$jeton&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;''&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$url&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'https://oa.dnc.global/oauth/token.php'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$options&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'method'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'POST'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'datas'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;a href=&#034;http://www.php.net/array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'grant_type'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'authorization_code'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'code'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'$AuthCode'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'client_id'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'XXXXXX'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'client_secret'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'XXXXXXXXXXX'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$res&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; recuperer_url&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$url&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$options&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$page&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/json_decode&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;json_decode&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$res&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'page'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;true&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$token&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$page&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'access_token'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://static.oa.dnc.global/local/cache-code/bac4f19cc18a52fc679ef0cd348ba0ab.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;&lt;h3 class=&#034;spip&#034;&gt;Compl&#233;ments &#224; propos du type de flux JWT Bearer&lt;/h3&gt;
&lt;p&gt;Comme son nom l'indique, ce flux d'autorisation transporte un &lt;a href='https://static.oa.dnc.global/-Sujets-communs-a-Oauth-2-et-OpenID-Connect-.html#jsonwebtokenjwt' class='spip_in'&gt;jeton JWT (JSON Web Token)&lt;/a&gt; au lieu d'un simple jeton opaque. Ce faisant, la validation du jeton est plus s&#251;re et des informations sur l'application et l'utilisateur sont directement v&#233;hicul&#233;es par le jeton.&lt;/p&gt;
&lt;p&gt;Le type de flux JWT Bearer r&#233;clame plus de param&#232;tres dans la requ&#234;te et effectue des v&#233;rifications concernant l'application cliente et l'utilisateur final.&lt;/p&gt;
&lt;p&gt;En plus des param&#232;tres d&#233;crits pr&#233;c&#233;demment, JWT Bearer demande que le param&#232;tre suivant lui soit post&#233; :
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; assertion : Un jeton JWT.&lt;/p&gt;
&lt;p&gt;Par exemple, dans le cas d'un &lt;strong&gt;flux d'autorisation&lt;/strong&gt; (Authorization Code Grant) :&lt;/p&gt;
&lt;div style='text-align: left;' class='spip_code' dir='ltr'&gt;&lt;code&gt;POST /token.oauth2 HTTP/1.1&lt;br /&gt; Host: oa.dnc.global&lt;br /&gt; Content-Type: application/x-www-form-urlencoded&lt;br /&gt; grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&amp;assertion=eyJhtpZCI6IjE2In0.eyJpc3Mi.J9l-ZhwP.&lt;/code&gt;&lt;/div&gt;
&lt;p&gt;Dans le cas d'un flux d'&lt;strong&gt;authentification d'une application cliente&lt;/strong&gt; (Client Authentication), le contr&#244;leur Token met en oeuvre l'interface ClientAssertionType. Il faut alors fournir (voir &lt;a href=&#034;https://tools.ietf.org/html/rfc7523#section-2&#034; class='spip_out' rel='external'&gt;RFC 7523&lt;/a&gt;) :
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; client_assertion_type : urn:ietf:params:oauth:grant-type:jwt-bearer,
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; client_assertion : Un jeton JWT.&lt;/p&gt;
&lt;p&gt;Par exemple :&lt;/p&gt;
&lt;div style='text-align: left;' class='spip_code' dir='ltr'&gt;&lt;code&gt;POST /token.oauth2 HTTP/1.1&lt;br /&gt; Host: as.example.com&lt;br /&gt; Content-Type: application/x-www-form-urlencoded&lt;br /&gt;
&lt;br /&gt; grant_type=authorization_code&amp;&lt;br /&gt; code=n0esc3NRze7LTCu7iYzS6a5acc3f0ogp4&amp;&lt;br /&gt; client_assertion_type=urn%3Aietf%3Aparams%3Aoauth%3Aclient-assertion-type%3Ajwt-bearer&amp;client_assertion=eyJhtpZCI6IjE2In0.eyJpc3Mi.J9l-ZhwP.&lt;/code&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;En cas d'&#233;chec&lt;/strong&gt;, la r&#233;ponse HTTP ainsi que les valeurs de error et error_description sont donn&#233;es par le tableau suivant :&lt;/p&gt;
&lt;table class=&#034;spip&#034;&gt;
&lt;tbody&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;&lt;strong&gt;R&#233;ponse&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;error&lt;br class='autobr' /&gt;
titre de l'erreur&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;error_description&lt;br class='autobr' /&gt;
description de l'erreur&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Explication&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_request&lt;/td&gt;
&lt;td&gt;The request method must be POST when revoking an access token&lt;/td&gt;
&lt;td&gt;La m&#233;thode de la demande doit &#234;tre POST lorsque vous r&#233;voquez un jeton d'acc&#232;s&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_request&lt;/td&gt;
&lt;td&gt;Missing parameters : &#034;assertion&#034; required&lt;/td&gt;
&lt;td&gt;Le parm&#232;tre assertion, passant le jeton JWT manque&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_request&lt;/td&gt;
&lt;td&gt;JWT is malformed&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_grant&lt;/td&gt;
&lt;td&gt;Invalid issuer (iss) provided&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_grant&lt;/td&gt;
&lt;td&gt;Invalid subject (sub) provided&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_grant&lt;/td&gt;
&lt;td&gt;Expiration (exp) time must be present&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_grant&lt;/td&gt;
&lt;td&gt;JWT has expired&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_grant&lt;/td&gt;
&lt;td&gt;Expiration (exp) time must be a unix time stamp&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_grant&lt;/td&gt;
&lt;td&gt;JWT cannot be used before the Not Before (nbf) time&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_grant&lt;/td&gt;
&lt;td&gt;Not Before (nbf) time must be a unix time stamp&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_grant&lt;/td&gt;
&lt;td&gt;Invalid audience (aud)&lt;/td&gt;
&lt;td&gt;Le param&#232;tre audience ( Token Endpoint URI, URI du point de terminaison de jeton) est invalide&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_grant&lt;/td&gt;
&lt;td&gt;JSON Token Identifier (jti) has already been used&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_grant&lt;/td&gt;
&lt;td&gt;Invalid issuer (iss) or subject (sub) provided&lt;/td&gt;
&lt;td&gt;La cl&#233; publique n'a pas &#233;t&#233; trouv&#233;e pour le couple issuer (iss) - subject (sub) fourni par le jeton&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_grant&lt;/td&gt;
&lt;td&gt;JWT failed signature verification&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>
<item xml:lang="fr">
		<title>Validation du jeton d'acc&#232;s par interrogation du point d'extr&#233;mit&#233; &#034;resource&#034;</title>
		<link>https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html#validationdujetondaccesparinterrogationdupointdextremiteresource</link>
		<guid isPermaLink="true">https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html#validationdujetondaccesparinterrogationdupointdextremiteresource</guid>
		<dc:date>2016-11-04T18:38:21Z</dc:date>
		<dc:format>text/html</dc:format>
		<dc:language>fr</dc:language>
		<dc:creator>DnC</dc:creator>



		<description>
&lt;p&gt;La norme OAuth 2.0 n'indique pas comment les serveurs de donn&#233;es prot&#233;g&#233;es qui re&#231;oivent un jeton d'acc&#232;s doivent proc&#233;der pour le valider, que ce soit localement ou en s'adressant &#224; point d'entr&#233;e d&#233;di&#233; &#224; sa validation [1] [2]. &lt;br class='autobr' /&gt;
Avec OAuthSD, les applications peuvent acc&#233;der au point d'extr&#233;mit&#233; &#034;resource &#034; pour valider le jeton d'acc&#232;s re&#231;u. Notons qu'OAuthSD impl&#233;mente &#233;galement le standard OpenID Connect &#034;Introspection Endpoint&#034;. &lt;br class='autobr' /&gt;
Les donn&#233;es de profil de l'utilisateur final sont transmises avec la r&#233;ponse, (...)&lt;/p&gt;


-
&lt;a href="https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html" rel="directory"&gt;Gestion du jeton d'acc&#232;s&lt;/a&gt;


		</description>


 <content:encoded>&lt;div class='rss_chapo'&gt;&lt;p&gt;La norme OAuth 2.0 n'indique pas comment les serveurs de donn&#233;es prot&#233;g&#233;es qui re&#231;oivent un jeton d'acc&#232;s doivent proc&#233;der pour le valider, que ce soit localement ou en s'adressant &#224; point d'entr&#233;e d&#233;di&#233; &#224; sa validation&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb5-1' class='spip_note' rel='appendix' title='La sp&#233;cification OAuth 2.0, RFC6749, aborde tr&#232;s pr&#233;cis&#233;ment ce probl&#232;me dans (...)' id='nh5-1'&gt;1&lt;/a&gt;]&lt;/span&gt;&lt;span class=&#034;spip_note_ref&#034;&gt; [&lt;a href='#nb5-2' class='spip_note' rel='appendix' title='OpenID Connect offre une solution : Validation du jeton d'acc&#232;s avec la (...)' id='nh5-2'&gt;2&lt;/a&gt;]&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;Avec OAuthSD, les applications peuvent acc&#233;der au point d'extr&#233;mit&#233; &#034;resource &#034; pour valider le jeton d'acc&#232;s re&#231;u. Notons qu'OAuthSD impl&#233;mente &#233;galement le standard OpenID Connect &lt;a href='https://static.oa.dnc.global/-API-OpenID-Connect-Points-d-extremite-.html#apiopenidconnectintrospectionintrospectionendpoint' class='spip_in'&gt;&#034;Introspection Endpoint&#034;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Les donn&#233;es de profil de l'utilisateur final sont transmises avec la r&#233;ponse, ce qui renforce la s&#233;curit&#233; des donn&#233;es prot&#233;g&#233;es : en permettant l'authentification de l'utilisateur final au niveau des fournisseurs de ressources prot&#233;g&#233;es, on leur permet d'adapter la r&#233;ponse en fonction de son statut.&lt;/p&gt;
&lt;p&gt;Le fait que OAuthSD propose cette m&#233;thode d'authentification ne change en rien au fait que &lt;a href='https://static.oa.dnc.global/-Tests-et-certification-.html' class='spip_in'&gt;ce serveur est enti&#232;rement compatible avec la norme OAuth 2.0 - OpenID Connect&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
		&lt;div class='rss_texte'&gt;&lt;p&gt;Rappelons le fait que, tr&#232;s souvent (le plus souvent ?) le serveur d'autorisation et les API prot&#233;g&#233;es appartiennent &#224; la m&#234;me organisation. Dans cette configuration, la fa&#231;on dont le jeton d'acc&#232;s est g&#233;n&#233;r&#233; et v&#233;rifi&#233; est opaque pour l'utilisateur. Le cas qui nous int&#233;resse est celui dans lequel il y a une certaine ind&#233;pendance des API et du serveur d'autorisation.&lt;/p&gt;
&lt;p&gt;Cette probl&#233;matique est expos&#233;e ici dans sa g&#233;n&#233;ralit&#233; : &lt;a href='https://static.oa.dnc.global/-OAuth-2-0-.html#validationdujetonparuneressourceprotegee' class='spip_in'&gt;Validation du jeton par une ressource prot&#233;g&#233;e&lt;/a&gt;.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Demande de validation du jeton d'acc&#232;s&lt;/h3&gt;
&lt;p&gt;Une solution est de demander au serveur d'autorisation d'authentifier le jeton d'acc&#232;s. La demande est adress&#233;e par le serveur de ressource &#224; OAuthSD sur le &lt;strong&gt;point d'extr&#233;mit&#233; de ressource&lt;/strong&gt; &#224; l'URI :&lt;/p&gt;
&lt;p&gt;&lt;code class='spip_code' dir='ltr'&gt;https://oa.dnc.global/oauth/resource.php&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Le jeton est pass&#233; par l'une des m&#233;thodes suivantes : Auth Header, GET ou POST.&lt;/p&gt;
&lt;p&gt;Une seule m&#233;thode doit &#234;tre utilis&#233;e &#224; la fois, sinon le serveur retourne '400, invalid_request'.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;M&#233;thode Auth Header :&lt;/strong&gt;&lt;br class='autobr' /&gt;
C'est la m&#233;thode recommand&#233;e.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;M&#233;thodes POST :&lt;/strong&gt;&lt;br class='autobr' /&gt;
Le jeton est pass&#233; avec le param&#232;tre &#034;access_token&#034;. Lorsque vous placez le jeton dans le corps de la requ&#234;te HTTP, la m&#233;thode doit &#234;tre POST ou PUT. Sinon, le serveur retourne 400, 'invalid_request', 'When putting the token in the body, the method must be POST or PUT', '#section-2.2'.&lt;/p&gt;
&lt;p&gt;Le type de contenu pour les requ&#234;tes POST doit &#234;tre &#034;application / x-www-form-urlencoded. Si ce n'est pas le cas, le serveur retourne 400, 'invalid_request', 'The content type for POST requests must be &#034;application/x-www-form-urlencoded&#034;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;M&#233;thodes GET :&lt;/strong&gt;&lt;br class='autobr' /&gt;
Cette m&#233;thode n'est pas recommand&#233;e pour des raisons de s&#233;curit&#233;.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;R&#233;ponse du serveur&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;En cas de succ&#232;s&lt;/strong&gt;, le serveur retourne une r&#233;ponse HTTP 200.&lt;/p&gt;
&lt;p&gt;Le corps de la r&#233;ponse contient un tableau portant les informations suivantes sur le jeton d'acc&#232;s :&lt;/p&gt;
&lt;table class=&#034;spip&#034;&gt;
&lt;thead&gt;&lt;tr class='row_first'&gt;&lt;th id='id6919_c0'&gt; index &lt;/th&gt;&lt;th id='id6919_c1'&gt; type &lt;/th&gt;&lt;th id='id6919_c2'&gt; valeur &lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td headers='id6919_c0'&gt;status&lt;/td&gt;
&lt;td headers='id6919_c1'&gt;entier&lt;/td&gt;
&lt;td headers='id6919_c2'&gt;code HTTP&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td headers='id6919_c0'&gt;headers&lt;/td&gt;
&lt;td headers='id6919_c1'&gt;string&lt;/td&gt;
&lt;td headers='id6919_c2'&gt;Headers de la r&#233;ponse&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td headers='id6919_c0'&gt;page&lt;/td&gt;
&lt;td headers='id6919_c1'&gt;string&lt;/td&gt;
&lt;td headers='id6919_c2'&gt;JSON Array :&lt;br class='autobr' /&gt;
success : true,&lt;br class='autobr' /&gt;
client_id : ID de l'application cliente&lt;br class='autobr' /&gt;
user_id : ID de l'utilisateur final&lt;br class='autobr' /&gt;
expires : Unix Time de la fin de validit&#233; (long) (secondes depuis le 1&#176; janvier 1970).&lt;br class='autobr' /&gt;
scope : liste des scopes de l'application cliente&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;En cas d'&#233;chec&lt;/strong&gt;, l'ent&#234;te de la r&#233;ponse contient un champ 'WWW-Authenticate' avec le type d'authentification suivi de l'erreur.&lt;/p&gt;
&lt;p&gt;Le corps de la r&#233;ponse contient :&lt;/p&gt;
&lt;table class=&#034;spip&#034;&gt;
&lt;thead&gt;&lt;tr class='row_first'&gt;&lt;th id='id6d2b_c0'&gt; index &lt;/th&gt;&lt;th id='id6d2b_c1'&gt; type &lt;/th&gt;&lt;th id='id6d2b_c2'&gt; valeur &lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td headers='id6d2b_c0'&gt;page&lt;/td&gt;
&lt;td headers='id6d2b_c1'&gt;string&lt;/td&gt;
&lt;td headers='id6d2b_c2'&gt;JSON Array :&lt;br class='autobr' /&gt;
error : titre de l'erreur,&lt;br class='autobr' /&gt;
error_description : description de l'erreur&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;La r&#233;ponse HTTP ainsi que les valeurs de error et error_description sont donn&#233;es par le tableau suivant :&lt;/p&gt;
&lt;table class=&#034;spip&#034;&gt;
&lt;tbody&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;&lt;strong&gt;R&#233;ponse&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;error&lt;br class='autobr' /&gt;
titre de l'erreur&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;error_description&lt;br class='autobr' /&gt;
description de l'erreur&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Explication&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_request&lt;/td&gt;
&lt;td&gt;Only one method may be used to authenticate at a time (Auth header, GET or POST)&lt;/td&gt;
&lt;td&gt;La requ&#234;te est mal form&#233;e&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_request&lt;/td&gt;
&lt;td&gt;Malformed auth header&lt;/td&gt;
&lt;td&gt;La requ&#234;te de type Auth header est mal form&#233;e&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_request&lt;/td&gt;
&lt;td&gt;When putting the token in the body, the method must be POST or PUT&lt;/td&gt;
&lt;td&gt;Si on place le token dans le corps de la requ&#234;te, la m&#233;thode ne peut &#234;tre que POST ou PUT&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;400&lt;/td&gt;
&lt;td&gt;invalid_request&lt;/td&gt;
&lt;td&gt;The content type for POST requests must be &#034;application/x-www-form-urlencoded&lt;/td&gt;
&lt;td&gt;l'IETF sp&#233;cifie ce type de contenu. NB : tous les serveurs Web ne remplissent pas cette variable _SERVER voir &lt;a href=&#034;http://tools.ietf.org/html/rfc6750#section-2.2&#034; class='spip_url spip_out auto' rel='nofollow external'&gt;http://tools.ietf.org/html/rfc6750#section-2.2&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;401&lt;/td&gt;
&lt;td&gt;invalid_token&lt;/td&gt;
&lt;td&gt;The access token provided is invalid&lt;/td&gt;
&lt;td&gt;le jeton ne figure pas dans le tokenStorage du serveur. Tr&#232;s probablement une tentative de violation d'acc&#232;s.&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_odd odd'&gt;
&lt;td&gt;401&lt;/td&gt;
&lt;td&gt;expired_token&lt;/td&gt;
&lt;td&gt;The access token provided has expired&lt;/td&gt;
&lt;td&gt;Le jeton a expir&#233;. L'application doit obtenir un nouveau jeton et relancer la requ&#234;te&lt;/td&gt;&lt;/tr&gt;
&lt;tr class='row_even even'&gt;
&lt;td&gt;403&lt;/td&gt;
&lt;td&gt;insufficient_scope&lt;/td&gt;
&lt;td&gt;The request requires higher privileges than provided by the access token&lt;/td&gt;
&lt;td&gt;Le scope (&#233;ventuellement) transmis avec la requ&#234;te ne correspond pas aux scopes autoris&#233;s pour l'application.&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;&lt;strong&gt;Notes :&lt;/strong&gt;
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Si on adresse une requ&#234;te avec un jeton d'acc&#232;s nul (empty string), le contr&#244;leur ressource retourne le code HTTP 401, mais le corps de la r&#233;ponse est vide, alors que l'on s'attendrait &#224; error = 'invalid_token'. Il s'ensuit que l'on devrait traiter tous les codes HTTP 401 dont l'erreur n'est pas 'expired_token' comme &#233;tant une tentative de violation d'acc&#232;s.
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; En cas de tentative de violation d'acc&#232;s (code HTTP 401 et error = 'invalid_request', le mieux est sans doute de ne rien r&#233;pondre pour ne pas renseigner l'attaquant.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Exemples&lt;/h3&gt;
&lt;p&gt;Demande de validation d'un token d'acc&#232;s :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SPIP&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_php code&#034;&gt;&lt;div class=&#034;php&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;/*&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;Autorisation avec OAuth Server by DnC&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;Auteur : Bertrand degoy&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;Copyright (c) 2016 DnC&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;*/&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #000000; font-weight: bold;&#034;&gt;function&lt;/span&gt; oauth_authorize&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$accesstoken&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$Ok&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;false&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;!&lt;/span&gt;&lt;a href=&#034;http://www.php.net/empty&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;empty&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$accesstoken&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Interroger OAuth Server by DnC&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; include_spip&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'inc/distant'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$url&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;http://oa.dnc.global/oauth/resource.php?access_token=&#034;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;.&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$accesstoken&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$resource_response&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; recuperer_url&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$url&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;int&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$resource_response&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'status'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;===&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;200&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$page&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/json_decode&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;json_decode&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$resource_response&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'page'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;true&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$page&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'success'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'true'&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;a href=&#034;http://www.php.net/isset&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;isset&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$_SERVER&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;HTTP_ORIGIN&#034;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Acc&#232;s HTTP (CORS) : autoriser l'origine&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; include_spip&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'inc/headers'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$issuer&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;a href=&#034;http://www.php.net/trim&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;trim&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;a href=&#034;http://www.php.net/strtr&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;strtr&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$_SERVER&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;&#034;HTTP_ORIGIN&#034;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'&lt;&gt;&#034;\''&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'[]##'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;a href=&#034;http://www.php.net/header&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;header&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'Access-Control-Allow-Origin'&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$issuer&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$Ok&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;true&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$Ok&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://static.oa.dnc.global/local/cache-code/921d3ad54fd9d2fe8f1ff4743ca9b718.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;L'interrogation du serveur d'autorisation &#224; chaque acc&#232;s d'une ressource prot&#233;g&#233;e peut le surcharger. Pour &#233;viter cela, il est possible de mettre en cache la r&#233;ponse du serveur du c&#244;t&#233; du serveur de ressource. Avec SPIP, c'est le r&#244;le de la fonction &lt;a href=&#034;http://code.spip.net/autodoc/tree/ecrire/inc/distant.php.html#function_recuperer_url_cache&#034; class='spip_out' rel='external'&gt;recuperer_url_cache()&lt;/a&gt; qui pourra remplacer &lt;a href=&#034;http://code.spip.net/autodoc/tree/ecrire/inc/distant.php.html#function_recuperer_url&#034; class='spip_out' rel='external'&gt;recuperer_url()&lt;/a&gt; dans l'exemple pr&#233;c&#233;dent. La fonction permet de r&#233;gler le d&#233;lai de garde en cache, qu'il convient de fixer &#224; une dur&#233;e assez courte (quelques minutes par exemple), l'essentiel &#233;tant de ne pas bombarder le serveur. Voici un exemple :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SPIP&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_php code&#034; data-clipboard-text=&#034;$res = recuperer_url_cache( $url, array('delai_cache' =&gt; 300) );&#034;&gt;&lt;div class=&#034;php&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$res&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; recuperer_url_cache&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$url&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;a href=&#034;http://www.php.net/array&#034;&gt;&lt;span style=&#034;color: #990000;&#034;&gt;array&lt;/span&gt;&lt;/a&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'delai_cache'&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&gt;&lt;/span&gt; &lt;span style=&#034;color: #cc66cc;&#034;&gt;300&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;La fonction d&#233;crite pr&#233;c&#233;demment peut &#234;tre utilis&#233;e dans une fonction d'autorisation d'acc&#232;s &#224; un objet SPIP ( ici l'objet gis de radar ) :&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;SPIP&lt;/strong&gt;&lt;/p&gt;
&lt;div class=&#034;coloration_code code&#034;&gt;&lt;div class=&#034;spip_php code&#034;&gt;&lt;div class=&#034;php&#034;&gt;&lt;ol&gt;&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #000000; font-weight: bold;&#034;&gt;function&lt;/span&gt; _autoriser_gis&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$faire&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$quoi&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$id&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$qui&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;,&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$options&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$qui&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'statut'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;==&lt;/span&gt; &lt;span style=&#034;color: #0000ff;&#034;&gt;'0minirezo'&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// Toujours autoriser un administrateur&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;true&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;else&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;if&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$accesstoken&lt;/span&gt; &lt;span style=&#034;color: #339933;&#034;&gt;=&lt;/span&gt; &lt;span style=&#034;color: #000088;&#034;&gt;$_GET&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&#034;color: #0000ff;&#034;&gt;'token'&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#123;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #666666; font-style: italic;&#034;&gt;// V&#233;rifier le jeton d'acc&#232;s&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;return&lt;/span&gt; oauth_authorize&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&#034;color: #000088;&#034;&gt;$accesstoken&lt;/span&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt; &lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;else&lt;/span&gt; &lt;span style=&#034;color: #b1b100;&#034;&gt;return&lt;/span&gt; &lt;span style=&#034;color: #009900; font-weight: bold;&#034;&gt;false&lt;/span&gt;&lt;span style=&#034;color: #339933;&#034;&gt;;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt; &lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;li style=&#034;font-weight: normal; vertical-align:top;&#034;&gt;&lt;div style=&#034;&#034;&gt;&lt;span style=&#034;color: #009900;&#034;&gt;&#125;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;&lt;/div&gt;&lt;p class='download code_download'&gt;&lt;a href='https://static.oa.dnc.global/local/cache-code/cad586471a002aa068a5e3103237922e.txt'&gt;T&#233;l&#233;charger&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Notes :&lt;/strong&gt;
&lt;br /&gt;&lt;img src='https://static.oa.dnc.global/local/cache-vignettes/L8xH11/puce-32883.gif?1733817730' width='8' height='11' class='puce' alt=&#034;-&#034; /&gt; Dans le cas o&#249; l'application cliente et le serveur donn&#233;es prot&#233;g&#233;es se trouvent dans des domaines diff&#233;rents, il faut g&#233;rer l'autorisation HTTP. Voyez &lt;a href='https://static.oa.dnc.global/-Sujets-communs-a-Oauth-2-et-OpenID-Connect-.html#controledacceshttpcors' class='spip_in'&gt;Contr&#244;le d'acc&#232;s HTTP (CORS)&lt;/a&gt;.&lt;/p&gt;
&lt;h3 class=&#034;spip&#034;&gt;Introspection Endpoint&lt;/h3&gt;
&lt;p&gt;Le document &lt;a href=&#034;https://tools.ietf.org/html/rfc7662&#034; class='spip_out' rel='external'&gt;RFC 7662 : OAuth 2.0 Token Introspection&lt;/a&gt; propose une m&#233;thode identique dans le principe et tr&#232;s proche dans la r&#233;alisation. Les donn&#233;es retourn&#233;es sont au format JSON et se rapprochent du contenu d'un JSON Web Token (JWT).&lt;/p&gt;
&lt;p&gt;OAuthSD offre donc &#233;galement le &lt;a href='https://static.oa.dnc.global/-API-OpenID-Connect-Points-d-extremite-.html#apiopenidconnectintrospectionintrospectionendpoint' class='spip_in'&gt;point d'extr&#233;mit&#233; introspection&lt;/a&gt; suivant :&lt;/p&gt;
&lt;p&gt;&lt;code class='spip_code' dir='ltr'&gt;https://oa.dnc.global/oauth/introspect.php&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;La demande est effectu&#233;e comme pour l'appel &#224; 'resource', mais le param&#232;tre est 'token' au lieu de 'access_token'.&lt;/p&gt;
&lt;p&gt;En cas de succ&#232;s, la r&#233;ponse est conforme au document pr&#233;cit&#233;. Les donn&#233;es retourn&#233;es sont 'active', 'scope', 'client_id', 'username', 'exp'.&lt;/p&gt;
&lt;p&gt;A ces donn&#233;es, s'ajoute 'sub' dont la valeur est l'E-mail de l'utilisateur. Toutefois, cette donn&#233;e n'est pr&#233;sente que si l'E-mail de l'utilisateur a &#233;t&#233; v&#233;rifi&#233; (champ 'verify' de la table Users).&lt;/p&gt;
&lt;p&gt;En cas d'erreur, la r&#233;ponse est identique &#224; celle de 'resource'.&lt;/p&gt;
&lt;p&gt;Nota : voir &#233;galement : &lt;a href='https://static.oa.dnc.global/-JSON-Web-Token-JWT-JWS-.html#emettreunjetondaccesentantquejwt' class='spip_in'&gt;Emettre un jeton d'acc&#232;s en tant que JWT&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
		&lt;hr /&gt;
		&lt;div class='rss_notes'&gt;&lt;div id='nb5-1'&gt;
&lt;p&gt;&lt;span class=&#034;spip_note_ref&#034;&gt;[&lt;a href='#nh5-1' class='spip_note' title='Notes 5-1' rev='appendix'&gt;1&lt;/a&gt;] &lt;/span&gt;La sp&#233;cification OAuth 2.0, RFC6749, aborde tr&#232;s pr&#233;cis&#233;ment ce probl&#232;me dans la section 7 : Les m&#233;thodes utilis&#233;es par le serveur de ressource pour valider le jeton d'acc&#232;s (ainsi que toute r&#233;ponse d'erreur) d&#233;passent le cadre de cette sp&#233;cification, &lt;i&gt;mais impliquent g&#233;n&#233;ralement une interaction ou une coordination entre le serveur de ressources et le serveur d'autorisation&lt;/i&gt;&#034;.&lt;/p&gt;
&lt;/div&gt;&lt;div id='nb5-2'&gt;
&lt;p&gt;&lt;span class=&#034;spip_note_ref&#034;&gt;[&lt;a href='#nh5-2' class='spip_note' title='Notes 5-2' rev='appendix'&gt;2&lt;/a&gt;] &lt;/span&gt;OpenID Connect offre une solution : &lt;a href='https://static.oa.dnc.global/-Gestion-du-jeton-d-acces-.html#validationdujetondaccesavecladeclarationat_hashdujetondidentite' class='spip_in'&gt;Validation du jeton d'acc&#232;s avec la d&#233;claration at_hash du jeton d'identit&#233;&lt;/a&gt;.&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;
		
		</content:encoded>


		

	</item>



</channel>

</rss>
