1
0
Fork 0
mirror of synced 2024-06-02 19:04:49 +12:00

Updated OAuth endpoints

This commit is contained in:
eldadfux 2019-09-03 10:43:06 +03:00
parent 8f9e99a92d
commit ff5186a6a0
3 changed files with 5 additions and 10 deletions

View file

@ -17,17 +17,12 @@ return [
'controller' => 'controllers/account.php',
'sdk' => true,
],
'v1/auth' => [ //TODO MOVE TO AUTH CONTROLLER SCOPE -- You can also learn how to [configure support for our supported OAuth providers](/docs/oauth)
'v1/auth' => [ // Add to docs later: You can also learn how to [configure support for our supported OAuth providers](/docs/oauth)
'name' => 'Auth',
'description' => "The authentication service allows you to verify users accounts using basic email and password login or with a supported OAuth provider. The auth service also exposes methods to confirm users email account and recover users forgotten passwords.\n\n. You can review our currently available OAuth providers from your project console under the **'users'** menu.",
'controller' => 'controllers/auth.php',
'sdk' => true,
],
'v1/oauth' => [
'name' => 'OAuth',
'controller' => 'controllers/auth.php',
'sdk' => true,
],
'v1/avatars' => [
'name' => 'Avatars',
'description' => 'The avatars service aims to help you complete common and recitative tasks related to your app images, icons and avatars. Using this service we hope to save you some precious time and help you focus on solving your app real challenges.',

View file

@ -608,7 +608,7 @@ $utopia->get('/v1/auth/oauth/:provider')
->action(
function($provider, $success, $failure) use ($response, $request, $project)
{
$callback = $request->getServer('REQUEST_SCHEME', 'https') . '://' . $request->getServer('HTTP_HOST') . '/v1/oauth/callback/' . $provider . '/' . $project->getUid();
$callback = $request->getServer('REQUEST_SCHEME', 'https') . '://' . $request->getServer('HTTP_HOST') . '/v1/auth/oauth/callback/' . $provider . '/' . $project->getUid();
$appId = $project->getAttribute('usersOauth' . ucfirst($provider) . 'Appid', '');
$appSecret = $project->getAttribute('usersOauth' . ucfirst($provider) . 'Secret', '{}');
@ -674,7 +674,7 @@ $utopia->get('/v1/auth/oauth/callback/:provider/:projectId')
->action(
function($projectId, $provider, $code, $state) use ($response, $request, $domain)
{
$response->redirect($request->getServer('REQUEST_SCHEME', 'https') . '://' . $domain . '/v1/oauth/' . $provider . '/redirect?'
$response->redirect($request->getServer('REQUEST_SCHEME', 'https') . '://' . $domain . '/v1/auth/oauth/' . $provider . '/redirect?'
. http_build_query(['project' => $projectId, 'code' => $code, 'state' => $state]));
}
);
@ -695,7 +695,7 @@ $utopia->get('/v1/auth/oauth/:provider/redirect')
->action(
function($provider, $code, $state) use ($response, $request, $user, $projectDB, $project, $audit)
{
$callback = $request->getServer('REQUEST_SCHEME', 'https') . '://' . $request->getServer('HTTP_HOST') . '/v1/oauth/callback/' . $provider . '/' . $project->getUid();
$callback = $request->getServer('REQUEST_SCHEME', 'https') . '://' . $request->getServer('HTTP_HOST') . '/v1/auth/oauth/callback/' . $provider . '/' . $project->getUid();
$defaultState = ['success' => $project->getAttribute('url', ''), 'failure' => ''];
$validateURL = new URL();

View file

@ -344,7 +344,7 @@ $providers = $this->getParam('providers', []);
<p>To complete set up, add this OAuth redirect URI to your <?php echo ucfirst($provider); ?> app configuration.</p>
<div class="input-copy">
<input data-forms-copy type="text" disabled data-ls-bind="{{env.PROTOCOL}}://{{env.DOMAIN}}/v1/oauth/callback/<?php echo $provider; ?>/{{router.params.project}}" class="margin-bottom-no" />
<input data-forms-copy type="text" disabled data-ls-bind="{{env.PROTOCOL}}://{{env.DOMAIN}}/v1/auth/oauth/callback/<?php echo $provider; ?>/{{router.params.project}}" class="margin-bottom-no" />
</div>
</div>
</div>