summaryrefslogtreecommitdiff
path: root/views/auth_callback.php
blob: 3bafa57f68e81b527830089a4bf61ea2c9479a75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<div class="narrow">
  <?= partial('partials/header') ?>

<?php if($this->tokenEndpoint): ?>

  <?php if(!$this->auth): ?>

    <h3>Bad response from token endpoint</h3>
    <p>Your token endpoint returned a response that was not understood.</p>

  <?php else: ?>

    <?php if(k($this->auth, 'error')): ?>

      <h3>Error</h3>
      <p>Got an error response from the token endpoint:</p>
      <div class="bs-callout bs-callout-danger">
        <h4><?= $this->auth['error'] ?></h4>
        <?= k($this->auth, 'error_description') ? ('<p>'.$this->auth['error_description'].'</p>') : '' ?>
      </div>

    <?php else: ?>

      <!-- Check for all the required parts of the token -->
      <?php if(k($this->auth, array('me','access_token','scope'))): ?>

        <h3>Success!</h3>

        <p>All required values were found! You are now signed in.</p>
        <p><a href="<?= $this->destination ?>" class="btn btn-primary">Continue</a></p>

      <?php else: ?>

        <?php if(!k($this->auth, 'access_token')): ?>
          <h4>Missing <code>access_token</code></h4>
          <p>The token endpoint did not return an access token. The <code>access_token</code> parameter is the token the client will use to make requests to the Micropub endpoint.</p>
        <?php endif; ?>

        <?php if(!k($this->auth, 'me')): ?>
          <h4>Missing <code>me</code></h4>
          <p>The token endpoint did not return a "me" parameter. The <code>me</code> parameter lets this client know what user the token is for.</p>
        <?php endif; ?>

        <?php if(!k($this->auth, 'scope')): ?>
          <h4>Missing <code>scope</code></h4>
          <p>The token endpoint did not return a "scope" parameter. The <code>scope</code> parameter lets this client what permission the token represents.</p>
        <?php endif; ?>

      <?php endif; ?>

    <?php endif; ?>
  <?php endif; ?>


  <h3>Token endpoint response</h3>

  <p>Below is the raw response from your token endpoint (<?= $this->tokenEndpoint ?>):</p>
  <div class="bs-callout bs-callout-info pre">
    <?= $this->curl_error ?>
    <?= htmlspecialchars($this->response) ?>
  </div>


<?php else: ?>


  <h3>Error</h3>
  <p>Could not find your token endpoint. We found it last time, so double check nothing on your website has changed in the mean time.</p>


<?php endif; ?>

</div>