<\/HEAD>
Estou tentando obter um token para ArcGIS Online usando c# (bem, mais especificamente SSIS). Eu tenho uma URL que posso usar e que funciona bem, e consigo acessá-la e obter o que preciso no Chrome, mas não funciona através do c# usando um WebClient.<\/SPAN><\/P>
<\/P>
Consigo obter outros jsons através dele via SSIS\/C# WebClient, mas POR ALGUM motivo NÃO consigo com ArcGIS Online. A URL funciona no Chrome, mas não retorna uma resposta via SSIS\/C# WebClient.<\/P>
Meu código (com client id\/secret\/credentials) é:<\/P>
<SPAN class="" style="color: #101094; border: 0px; font-weight: inherit; font-size: 13px;">string<\/SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"> webResource <\/SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">=<\/SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"> <\/SPAN><SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: 13px;">"https:\/\/mymaps.maps.arcgis.com\/sharing\/rest\/oauth2\/token?client_id=MYCLIENTID&client_secret=MYCLIENTSECRET&grant_type=client_credentials"<\/SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">;<\/SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"><\/SPAN><SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: 13px;">WebClient<\/SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"> wc <\/SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">=<\/SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"> <\/SPAN><SPAN class="" style="color: #101094; border: 0px; font-weight: inherit; font-size: 13px;">new<\/SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"> <\/SPAN><SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: 13px;">WebClient<\/SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">();<\/SPAN><SPAN class="" style="color:#303336;border:none;font-weight:inherit;font-size:13px;"><\/SPAN><SPAN class="" style="color:#101094;border:none;font-weight:inherit;font-size:13px;"><!-- -->string<!-- --></SPAN><!-- --> json <!-- -->
Eu então faria o parse do json.
Atualmente estou recebendo:
DTS <span style='color:#2b91af'>Script</span> <span>Task</span> encontrou uma exceção <span style='color:#101094'>no</span> código do usuário:<br>nome do projeto:<br>ST_0a306cf2e1634509bea49b75b7d93265 <span style='color:#2b91af'>Exception</span> foi lançada <span style='color:#101094'>pelo</span> alvo de uma invocação.<br>em <span style='color:#2b91af'>System</span>.<span>RuntimeMethodHandle</span>.InvokeMethod(<span style='color:#2b91af'>Object</span> target, <span style='color:#2b91af'>Object</span>[] arguments, <span style='color:#2b91af'>Signature</span> sig, <span style='color:#2b91af'>Boolean</span> constructor)<br>em <span style='color:#2b91af'>System</span>.<span>Reflection</span>.RuntimeMethodInfo.UnsafeInvokeInternal(<span style='color:#2b91af'>Object</span> obj, <span style='color:#2b91af'>Object</span>[] parameters, <span #303336; border: 0px; font-weight: inherit; font-size: 13px;"> argumentos</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">)</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"> em </SPAN><SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: 13px;">System</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">.</SPAN><SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: 13px;">Reflection</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">.</SPAN><SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: 13px;">RuntimeMethodInfo</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">.</SPAN><SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: 13px;">Invoke</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">(</SPAN><SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: 13px;">Object</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"> obj</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">,</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"> </SPAN><SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: 13px;">BindingFlags</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"> invokeAttr</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">,</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;"> </SPAN><SPAN class="" style="color: #2b91af; border: 0px; font-weight: inherit; font-size: 13px;">Binder</SPAN><SPAN class="" style="color:#303336;border:none;font-weight:auto;font-size:#303336;font-size:#303336;font-size:#303336;font-size:#303336;font-size:#303336;font-size:#303336;font-size:#303336;font-size:#303336;font-size:#303336;font-size:#303336;font-size:#303336;font-size:#303336;font-size:#303336;font-size:#303336;font-siz... border: 0px; font-weight: inherit; font-size: 13px;">,</SPAN><SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: 13px;">"expires_in"</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">:</SPAN><SPAN class="" style="color: #7d2727; border: 0px; font-weight: inherit; font-size: 13px;">7200</SPAN><SPAN class="" style="color: #303336; border: 0px; font-weight: inherit; font-size: 13px;">}</SPAN>