Skip to content

Commit

Permalink
Merge pull request #10 from fgmusp/issue_9
Browse files Browse the repository at this point in the history
fix #9 Identificar ambiente de desenvolvimento e producao
  • Loading branch information
masakik authored Oct 30, 2019
2 parents 220652d + cdebaa7 commit 5adcecf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $auth = new Uspdev\Senhaunica\Senhaunica([
'consumer_key' => 'aaaa',
'consumer_secret' => 'sdkjfcsdkfhsdkfhsdkfhsdhkf',
'callback_id' => 1, // callback_id é o sequencial no servidor
'amb' => 1,// 1=teste, 2=producao
'amb' => 'dev',// 'dev' = teste, 'prod' = producao
]);

$res = $auth->login();
Expand All @@ -41,3 +41,5 @@ echo '</pre>';
header('Location:/alguma_rota');

```

OBS: Anteriormente o ambiente era setado como 1=dev e 2=prod. Nas novas versões os números 1 e 2 serão descontinuados, premanecendo somente 'dev' e 'prod'.
7 changes: 5 additions & 2 deletions src/Senhaunica.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ class Senhaunica

public function __construct($oauth)
{
if ($oauth['amb'] == 1) {
if ($oauth['amb'] == 1 || $oauth['amb'] == 'dev') {
$oauth_host = "https://dev.uspdigital.usp.br"; // ambiente de teste
} else {
} elseif ($oauth['amb'] == 2 || $oauth['amb'] == 'prod') {
$oauth_host = "https://uspdigital.usp.br"; // ambiente de producao
} else {
echo 'Ambiente não configurado!';
exit;
}

$this->user_data_url = $oauth_host . "/wsusuario/oauth/usuariousp";
Expand Down

0 comments on commit 5adcecf

Please sign in to comment.