2022-06-29 11:28:26 +02:00
|
|
|
{% extends "developer/client_details/base.html" %}
|
2019-08-16 12:03:45 +02:00
|
|
|
|
|
|
|
{% set client_details_page = "oauth_setting" %}
|
|
|
|
{% block client_details_content %}
|
2022-06-29 11:28:26 +02:00
|
|
|
|
2019-08-16 12:03:45 +02:00
|
|
|
<form method="post">
|
|
|
|
{{ form.csrf_token }}
|
2021-10-26 11:55:42 +02:00
|
|
|
<h1 class="h2">OAuth2 Settings</h1>
|
2019-08-16 12:03:45 +02:00
|
|
|
<div class="form-group">
|
2019-09-02 21:28:56 +02:00
|
|
|
<label class="form-label">AppID / OAuth2 Client ID</label>
|
2019-08-16 12:03:45 +02:00
|
|
|
<div class="input-group mt-2">
|
2022-06-29 11:28:26 +02:00
|
|
|
<input disabled
|
|
|
|
type="text"
|
|
|
|
value="{{ client.oauth_client_id }}"
|
|
|
|
class="form-control">
|
2019-08-16 12:03:45 +02:00
|
|
|
<span class="input-group-append">
|
2022-06-29 11:28:26 +02:00
|
|
|
<button data-clipboard-text="{{ client.oauth_client_id }}"
|
|
|
|
class="clipboard btn btn-primary"
|
|
|
|
type="button">
|
2019-08-16 12:03:45 +02:00
|
|
|
<i class="fe fe-clipboard"></i>
|
|
|
|
</button>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="form-group">
|
2019-09-02 21:28:56 +02:00
|
|
|
<label class="form-label">AppSecret / OAuth2 Client Secret</label>
|
2019-08-16 12:03:45 +02:00
|
|
|
<div class="input-group mt-2">
|
2022-06-29 11:28:26 +02:00
|
|
|
<input disabled
|
|
|
|
type="password"
|
|
|
|
value="{{ client.oauth_client_secret }}"
|
|
|
|
class="form-control">
|
2019-08-16 12:03:45 +02:00
|
|
|
<span class="input-group-append">
|
2022-06-29 11:28:26 +02:00
|
|
|
<button data-clipboard-text="{{ client.oauth_client_secret }}"
|
|
|
|
class="clipboard btn btn-primary"
|
|
|
|
type="button">
|
2019-08-16 12:03:45 +02:00
|
|
|
<i class="fe fe-clipboard"></i>
|
|
|
|
</button>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-06-29 11:28:26 +02:00
|
|
|
<hr />
|
2019-08-16 12:03:45 +02:00
|
|
|
<div class="form-group">
|
2021-04-01 11:05:58 +02:00
|
|
|
<label class="form-label">Authorized Redirect URIs</label>
|
|
|
|
<small class="text-muted">
|
2022-06-29 11:28:26 +02:00
|
|
|
By default <b>localhost</b> is whitelisted.
|
|
|
|
<br />
|
2021-04-01 11:05:58 +02:00
|
|
|
A <b>redirect_uri</b> must be <b>HTTPS</b> for security reason.
|
|
|
|
</small>
|
2019-08-16 12:03:45 +02:00
|
|
|
{% if not client.redirect_uris %}
|
2022-06-29 11:28:26 +02:00
|
|
|
|
|
|
|
<div class="alert alert-warning alert-dismissible fade show mb-4"
|
|
|
|
role="alert">
|
2019-09-02 11:48:11 +02:00
|
|
|
<p>
|
2022-06-29 11:28:26 +02:00
|
|
|
You haven't added any
|
|
|
|
<a href="https://www.oauth.com/oauth2-servers/redirect-uris/">redirect_uri</a>
|
|
|
|
,
|
2020-07-16 23:48:47 +02:00
|
|
|
that is the url that will receive the <b>code</b> or <b>access-token</b> in OAuth2 flow.
|
2019-09-02 11:48:11 +02:00
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
There's NO NEED to add <em>http://localhost:*</em> as by default,
|
2020-07-16 23:48:47 +02:00
|
|
|
SimpleLogin <b>whitelists</b> localhost (unlike Facebook).
|
2019-09-02 11:48:11 +02:00
|
|
|
</p>
|
|
|
|
<p>
|
2021-10-25 11:09:30 +02:00
|
|
|
You DO need to add your <b>redirect_uri</b> once your app goes live (i.e. deployed on production).
|
2019-09-02 11:48:11 +02:00
|
|
|
</p>
|
|
|
|
<p>
|
2020-07-16 23:48:47 +02:00
|
|
|
The <b>redirect_uri</b> needs to be <b>HTTPS</b> for security reason.
|
2019-09-02 11:48:11 +02:00
|
|
|
</p>
|
|
|
|
<p>
|
2020-07-16 23:48:47 +02:00
|
|
|
Start by adding your first <b>redirect_uri</b> here 👇
|
2019-09-02 11:48:11 +02:00
|
|
|
</p>
|
|
|
|
</div>
|
2019-08-16 12:03:45 +02:00
|
|
|
{% endif %}
|
|
|
|
{% for redirect_uri in client.redirect_uris %}
|
2022-06-29 11:28:26 +02:00
|
|
|
|
2019-08-16 12:03:45 +02:00
|
|
|
<div class="input-group mt-2">
|
2022-06-29 11:28:26 +02:00
|
|
|
<input type="url"
|
|
|
|
name="uri"
|
|
|
|
class="form-control"
|
|
|
|
value="{{ redirect_uri.uri }}"
|
|
|
|
required
|
|
|
|
pattern="^https:\/\/.*"
|
2019-08-16 12:03:45 +02:00
|
|
|
title="redirect_uri must be https">
|
|
|
|
<span class="input-group-append">
|
|
|
|
<button class="remove-uri btn btn-primary" type="button">
|
|
|
|
<i class="fe fe-x"></i>
|
|
|
|
</button>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
|
|
|
<div id="new-uris">
|
|
|
|
<!-- New uri will be put here -->
|
|
|
|
</div>
|
|
|
|
<button type="button" id="create-new-uri" class="mt-2 btn btn-secondary">Add new uri</button>
|
|
|
|
</div>
|
2021-04-01 11:05:58 +02:00
|
|
|
<button type="submit" class="btn btn-primary">Update</button>
|
2019-08-16 12:03:45 +02:00
|
|
|
</form>
|
|
|
|
<!-- template for new uri -->
|
|
|
|
<div class="input-group mt-2" id="hidden-uri" style="display: none">
|
2022-06-29 11:28:26 +02:00
|
|
|
<input type="url"
|
|
|
|
name="uri"
|
|
|
|
class="form-control"
|
|
|
|
required
|
|
|
|
pattern="^https:\/\/.*"
|
2019-08-16 12:03:45 +02:00
|
|
|
title="redirect_uri must be https">
|
|
|
|
<span class="input-group-append">
|
|
|
|
<button class="remove-uri btn btn-primary" type="button">
|
|
|
|
<i class="fe fe-x"></i>
|
|
|
|
</button>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|
|
{% block script %}
|
2022-06-29 11:28:26 +02:00
|
|
|
|
2019-08-16 12:03:45 +02:00
|
|
|
<script>
|
|
|
|
$("#create-new-uri").on("click", function (e) {
|
|
|
|
var clone = $("#hidden-uri").clone(true, true); // (true, true) to clone withDataAndEvents, deepWithDataAndEvents
|
|
|
|
clone.removeAttr("id");
|
|
|
|
|
|
|
|
$("#new-uris").append(clone);
|
|
|
|
clone.show();
|
|
|
|
});
|
|
|
|
|
|
|
|
$(".remove-uri").click(function (e) {
|
|
|
|
var currentElement = $(this);
|
|
|
|
currentElement.parent().parent().remove();
|
|
|
|
});
|
|
|
|
|
|
|
|
</script>
|
2022-06-29 11:28:26 +02:00
|
|
|
{% endblock %}
|