{"id":52,"date":"2020-02-07T01:02:00","date_gmt":"2020-02-07T01:02:00","guid":{"rendered":"http:\/\/168.138.249.13\/?p=52"},"modified":"2020-08-06T03:31:45","modified_gmt":"2020-08-06T03:31:45","slug":"erro-401-unauthorized-mesmo-com-as-credenciais-corretas","status":"publish","type":"post","link":"https:\/\/adrianotanaka.com.br\/index.php\/2020\/02\/07\/erro-401-unauthorized-mesmo-com-as-credenciais-corretas\/","title":{"rendered":"Erro 401 Unauthorized mesmo com as credenciais corretas"},"content":{"rendered":"\n<p>Voc\u00ea j\u00e1 tentou se autenticar em algum servi\u00e7o no OCI via CLI ou API e recebeu um erro&nbsp;<strong>401 Unauthorized<\/strong>&nbsp;mesmo estando com as credenciais corretas?<\/p>\n\n\n\n<p>Caso voc\u00ea utilize o oci-cli, fica f\u00e1cil de identificar que o problema est\u00e1 na data\/hora do computador que est\u00e1 tentando se autenticar que n\u00e3o pode ter mais de 5 minutos de diferen\u00e7a com o servidor:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/i.imgur.com\/bfkOkZT.png\" alt=\"enter image description here\"\/><\/figure>\n\n\n\n<p>Mas e quando a data est\u00e1 correta?<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;oracle@dbtanaka ~]$ date\nSat Feb  8 21:41:50 UTC 2020\n&#91;oracle@dbtanaka ~]$ java -jar oci_install.jar -host https:\/\/objectstorage.sa-saopaulo-1.oraclecloud.com \\\n>   -pvtKeyFile \/home\/oracle\/.oci\/oci_api_key.pem \\\n>   -pubFingerPrint XXXXXXXXXXX \\\n>   -uOCID ocid1.user.XXXXXXXXX \\\n>   -tOCID XXXXXXXXXXXXX\\\n>   -walletDir $ORACLE_HOME\/opc\/wallet \\\n>    -bucket bkp-rman \\\n>   -configFile $ORACLE_HOME\/dbs\/opc${ORACLE_SID}.ora\nOracle Database Cloud Backup Module Install Tool, build 19.3.0.0.0DBBKPCSBP_2019-10-16\n  Error: Could not authenticate to Oracle Database Cloud Backup Module\nException in thread \"main\" java.lang.RuntimeException: java.io.IOException: testConnection: 401 Unauthorized.\n\tat oracle.backup.opc.install.BmcConfig.testConnection(BmcConfig.java:380)\n\tat oracle.backup.opc.install.BmcConfig.doBmcConfig(BmcConfig.java:227)\n\tat oracle.backup.opc.install.BmcConfig.main(BmcConfig.java:219)\nCaused by: java.io.IOException: testConnection: 401 Unauthorized.\n\tat oracle.backup.opc.install.BmcConfig.testConnection(BmcConfig.java:365)\n\t... 2 more\n&#91;oracle@dbtanaka ~]$ \n<\/code><\/pre>\n\n\n\n<p>Mesmo que a hora esteja correta, o timezone tamb\u00e9m precisa estar configurado corretamente, ent\u00e3o n\u00e3o se esque\u00e7am de deixar sempre o pacote tzdata atualizado ou ent\u00e3o definir manualmente as informa\u00e7\u00f5es (o que n\u00e3o \u00e9 muito recomendado):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;oracle@dbtanaka ~]$ date\nFri Feb  7 21:54:13 -03 2020\n&#91;oracle@dbtanaka ~]$ java -jar oci_install.jar -host https:\/\/objectstorage.sa-saopaulo-1.oraclecloud.com   -pvtKeyFile \/home\/oracle\/.oci\/oci_api_key.pem   -pubFingerPrint xxxxxxxxx   -uOCID xxxxxxxx   -tOCID xxxxxxx   -walletDir $ORACLE_HOME\/opc\/wallet    -bucket bkp-rman   -configFile $ORACLE_HOME\/dbs\/opc${ORACLE_SID}.ora\nOracle Database Cloud Backup Module Install Tool, build 19.3.0.0.0DBBKPCSBP_2019-10-16\nOracle Database Cloud Backup Module credentials are valid.\nBackups would be sent to bucket bkp-rman.\nOracle Database Cloud Backup Module wallet created in directory \/u01\/app\/oracle\/product\/11.2.0\/xe\/opc\/wallet.\nOracle Database Cloud Backup Module initialization file \/u01\/app\/oracle\/product\/11.2.0\/xe\/dbs\/opcXE.ora created.\nSkipping library download because option -libDir is not specified.\n&#91;oracle@dbtanaka ~]$ <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Voc\u00ea j\u00e1 tentou se autenticar em algum servi\u00e7o no OCI via CLI ou API e recebeu um erro&nbsp;401 Unauthorized&nbsp;mesmo estando com as credenciais corretas? Caso voc\u00ea utilize o oci-cli, fica f\u00e1cil de identificar que o problema est\u00e1 na data\/hora do computador que est\u00e1 tentando se autenticar que n\u00e3o pode ter mais de 5 minutos de [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"material-hide-sections":[],"footnotes":""},"categories":[6,1],"tags":[5,4,3],"class_list":["post-52","post","type-post","status-publish","format-standard","hentry","category-oracle","category-uncategorized","tag-banco-de-dados","tag-database","tag-oracle"],"_links":{"self":[{"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/posts\/52","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/comments?post=52"}],"version-history":[{"count":1,"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/posts\/52\/revisions"}],"predecessor-version":[{"id":53,"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/posts\/52\/revisions\/53"}],"wp:attachment":[{"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/media?parent=52"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/categories?post=52"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/adrianotanaka.com.br\/index.php\/wp-json\/wp\/v2\/tags?post=52"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}