File: credentials.html

package info (click to toggle)
python-exchangelib 5.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,364 kB
  • sloc: python: 25,367; sh: 6; makefile: 5
file content (879 lines) | stat: -rw-r--r-- 49,964 bytes parent folder | download
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
<meta name="generator" content="pdoc3 0.11.6">
<title>exchangelib.credentials API documentation</title>
<meta name="description" content="Implements an Exchange user object and access types. Exchange provides two different ways of granting access for a
login to a specific account …">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/typography.min.css" integrity="sha512-Y1DYSb995BAfxobCkKepB1BqJJTPrOp3zPL74AWFugHHmmdcvO+C48WLrUOlhGMc0QG7AE3f7gmvvcrmX2fDoA==" crossorigin>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css" crossorigin>
<style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:1.5em;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:2em 0 .50em 0}h3{font-size:1.4em;margin:1.6em 0 .7em 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .2s ease-in-out}a:visited{color:#503}a:hover{color:#b62}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900;font-weight:bold}pre code{font-size:.8em;line-height:1.4em;padding:1em;display:block}code{background:#f3f3f3;font-family:"DejaVu Sans Mono",monospace;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source > summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible;min-width:max-content}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em 1em;margin:1em 0}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style>
<style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul ul{padding-left:1em}.toc > ul > li{margin-top:.5em}}</style>
<style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style>
<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js" integrity="sha512-D9gUyxqja7hBtkWpPWGt9wfbfaMGVt9gnyCvYa+jojwwPHLCzUm5i8rpk7vD7wNee9bA35eYIjobYPaQuKS1MQ==" crossorigin></script>
<script>window.addEventListener('DOMContentLoaded', () => {
hljs.configure({languages: ['bash', 'css', 'diff', 'graphql', 'ini', 'javascript', 'json', 'plaintext', 'python', 'python-repl', 'rust', 'shell', 'sql', 'typescript', 'xml', 'yaml']});
hljs.highlightAll();
/* Collapse source docstrings */
setTimeout(() => {
[...document.querySelectorAll('.hljs.language-python > .hljs-string')]
.filter(el => el.innerHTML.length > 200 && ['"""', "'''"].includes(el.innerHTML.substring(0, 3)))
.forEach(el => {
let d = document.createElement('details');
d.classList.add('hljs-string');
d.innerHTML = '<summary>"""</summary>' + el.innerHTML.substring(3);
el.replaceWith(d);
});
}, 100);
})</script>
</head>
<body>
<main>
<article id="content">
<header>
<h1 class="title">Module <code>exchangelib.credentials</code></h1>
</header>
<section id="section-intro">
<p>Implements an Exchange user object and access types. Exchange provides two different ways of granting access for a
login to a specific account. Impersonation is used mainly for service accounts that connect via EWS. Delegate is used
for ad-hoc access e.g. granted manually by the user.
See <a href="https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/impersonation-and-ews-in-exchange">https://docs.microsoft.com/en-us/exchange/client-developer/exchange-web-services/impersonation-and-ews-in-exchange</a></p>
</section>
<section>
</section>
<section>
</section>
<section>
</section>
<section>
<h2 class="section-title" id="header-classes">Classes</h2>
<dl>
<dt id="exchangelib.credentials.BaseCredentials"><code class="flex name class">
<span>class <span class="ident">BaseCredentials</span></span>
</code></dt>
<dd>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">class BaseCredentials(metaclass=abc.ABCMeta):
    &#34;&#34;&#34;Base class for credential storage.&#34;&#34;&#34;

    def __eq__(self, other):
        return all(getattr(self, k) == getattr(other, k) for k in self.__dict__)

    def __hash__(self):
        return hash(tuple((getattr(self, k) for k in self.__dict__)))</code></pre>
</details>
<div class="desc"><p>Base class for credential storage.</p></div>
<h3>Subclasses</h3>
<ul class="hlist">
<li><a title="exchangelib.credentials.BaseOAuth2Credentials" href="#exchangelib.credentials.BaseOAuth2Credentials">BaseOAuth2Credentials</a></li>
<li><a title="exchangelib.credentials.Credentials" href="#exchangelib.credentials.Credentials">Credentials</a></li>
</ul>
</dd>
<dt id="exchangelib.credentials.BaseOAuth2Credentials"><code class="flex name class">
<span>class <span class="ident">BaseOAuth2Credentials</span></span>
<span>(</span><span>client_id, client_secret, tenant_id=None, identity=None, access_token=None)</span>
</code></dt>
<dd>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">class BaseOAuth2Credentials(BaseCredentials):
    &#34;&#34;&#34;Base class for all classes that implement OAuth 2.0 authentication&#34;&#34;&#34;

    def __init__(self, client_id, client_secret, tenant_id=None, identity=None, access_token=None):
        &#34;&#34;&#34;

        :param client_id: ID of an authorized OAuth application, required for automatic token fetching and refreshing
        :param client_secret: Secret associated with the OAuth application
        :param tenant_id: Microsoft tenant ID of the account to access
        :param identity: An Identity object representing the account that these credentials are connected to.
        :param access_token: Previously-obtained access token, as a dict or an oauthlib.oauth2.OAuth2Token
        &#34;&#34;&#34;
        super().__init__()
        self.client_id = client_id
        self.client_secret = client_secret
        self.tenant_id = tenant_id
        self.identity = identity
        self.access_token = access_token

        self._lock = RLock()

    @property
    def lock(self):
        return self._lock

    @property
    def access_token(self):
        return self._access_token

    @access_token.setter
    def access_token(self, access_token):
        if access_token is not None and not isinstance(access_token, dict):
            raise InvalidTypeError(&#34;access_token&#34;, access_token, oauthlib.oauth2.OAuth2Token)
        self._access_token = access_token

    def refresh(self, session):
        &#34;&#34;&#34;Obtain a new set of valid credentials. This is intended to support OAuth token refreshing, which can
        happen in long-running applications or those that cache access tokens and so might start with a token close to
        expiration.

        :param session: requests session asking for refreshed credentials
        :return:
        &#34;&#34;&#34;
        # Creating a new session gets a new access token, so there&#39;s no work here to refresh the credentials.

    def on_token_auto_refreshed(self, access_token):
        &#34;&#34;&#34;Set the access_token. Called after the access token is refreshed (requests-oauthlib can automatically
        refresh tokens if given an OAuth client ID and secret, so this is how our copy of the token stays up-to-date).
        Applications that cache access tokens can override this to store the new token - just remember to call the
        super() method.

        :param access_token: New token obtained by refreshing
        &#34;&#34;&#34;
        # Ensure we don&#39;t update the object in the middle of a new session being created, which could cause a race.
        with self.lock:
            log.debug(&#34;%s auth token for %s&#34;, &#34;Refreshing&#34; if self.access_token else &#34;Setting&#34;, self.client_id)
            self.access_token = access_token

    def sig(self):
        # Like hash(self), but pulls in the access token. Protocol.refresh_credentials() uses this to find out
        # if the access_token needs to be refreshed.
        res = []
        for k in self.__dict__:
            if k in (&#34;_lock&#34;, &#34;identity&#34;):
                continue
            if k == &#34;_access_token&#34;:
                res.append(self.access_token[&#34;access_token&#34;] if self.access_token else None)
                continue
            res.append(getattr(self, k))
        return hash(tuple(res))

    @property
    def token_url(self):
        &#34;&#34;&#34;The URL to request tokens from&#34;&#34;&#34;
        # We may not know (or need) the Microsoft tenant ID. If not, use common/ to let Microsoft select the appropriate
        # tenant for the provided authorization code or refresh token.
        return f&#34;https://login.microsoftonline.com/{self.tenant_id or &#39;common&#39;}/oauth2/v2.0/token&#34;  # nosec

    @property
    def scope(self):
        &#34;&#34;&#34;The scope we ask for the token to have&#34;&#34;&#34;
        return [&#34;https://outlook.office365.com/.default&#34;]

    def session_params(self):
        &#34;&#34;&#34;Extra parameters to use when creating the session&#34;&#34;&#34;
        res = {&#34;token&#34;: self.access_token}  # Token may be None
        if self.client_id and self.client_secret:
            # If we&#39;re given a client ID and secret, we have enough to refresh access tokens ourselves. In other
            # cases the session will raise TokenExpiredError, and we&#39;ll need to ask the calling application to
            # refresh the token (that covers cases where the caller doesn&#39;t have access to the client secret but
            # is working with a service that can provide it refreshed tokens on a limited basis).
            res.update(
                {
                    &#34;auto_refresh_kwargs&#34;: {
                        &#34;client_id&#34;: self.client_id,
                        &#34;client_secret&#34;: self.client_secret,
                    },
                    &#34;auto_refresh_url&#34;: self.token_url,
                    &#34;token_updater&#34;: self.on_token_auto_refreshed,
                }
            )
        return res

    @staticmethod
    def token_params():
        &#34;&#34;&#34;Extra parameters when requesting the token&#34;&#34;&#34;
        return {&#34;include_client_id&#34;: True}

    @threaded_cached_property
    @abc.abstractmethod
    def client(self):
        &#34;&#34;&#34;The client implementation to use for this credential class&#34;&#34;&#34;

    def __eq__(self, other):
        return all(getattr(self, k) == getattr(other, k) for k in self.__dict__ if k != &#34;_lock&#34;)

    def __hash__(self):
        # &#39;access_token&#39; may be refreshed once in a while. This should not affect the hash signature.
        # &#39;identity&#39; is just informational and should also not affect the hash signature.
        return hash(tuple(getattr(self, k) for k in self.__dict__ if k not in (&#34;_lock&#34;, &#34;identity&#34;, &#34;_access_token&#34;)))

    def __str__(self):
        return self.client_id

    def __repr__(self):
        return self.__class__.__name__ + repr((self.client_id, &#34;********&#34;))

    def __getstate__(self):
        # The lock cannot be pickled
        state = self.__dict__.copy()
        del state[&#34;_lock&#34;]
        return state

    def __setstate__(self, state):
        # Restore the lock
        self.__dict__.update(state)
        self._lock = RLock()</code></pre>
</details>
<div class="desc"><p>Base class for all classes that implement OAuth 2.0 authentication</p>
<p>:param client_id: ID of an authorized OAuth application, required for automatic token fetching and refreshing
:param client_secret: Secret associated with the OAuth application
:param tenant_id: Microsoft tenant ID of the account to access
:param identity: An Identity object representing the account that these credentials are connected to.
:param access_token: Previously-obtained access token, as a dict or an oauthlib.oauth2.OAuth2Token</p></div>
<h3>Ancestors</h3>
<ul class="hlist">
<li><a title="exchangelib.credentials.BaseCredentials" href="#exchangelib.credentials.BaseCredentials">BaseCredentials</a></li>
</ul>
<h3>Subclasses</h3>
<ul class="hlist">
<li><a title="exchangelib.credentials.OAuth2AuthorizationCodeCredentials" href="#exchangelib.credentials.OAuth2AuthorizationCodeCredentials">OAuth2AuthorizationCodeCredentials</a></li>
<li><a title="exchangelib.credentials.OAuth2Credentials" href="#exchangelib.credentials.OAuth2Credentials">OAuth2Credentials</a></li>
</ul>
<h3>Static methods</h3>
<dl>
<dt id="exchangelib.credentials.BaseOAuth2Credentials.token_params"><code class="name flex">
<span>def <span class="ident">token_params</span></span>(<span>)</span>
</code></dt>
<dd>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">@staticmethod
def token_params():
    &#34;&#34;&#34;Extra parameters when requesting the token&#34;&#34;&#34;
    return {&#34;include_client_id&#34;: True}</code></pre>
</details>
<div class="desc"><p>Extra parameters when requesting the token</p></div>
</dd>
</dl>
<h3>Instance variables</h3>
<dl>
<dt id="exchangelib.credentials.BaseOAuth2Credentials.access_token"><code class="name">prop <span class="ident">access_token</span></code></dt>
<dd>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">@property
def access_token(self):
    return self._access_token</code></pre>
</details>
<div class="desc"></div>
</dd>
<dt id="exchangelib.credentials.BaseOAuth2Credentials.client"><code class="name">var <span class="ident">client</span></code></dt>
<dd>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def __get__(self, obj, cls):
    if obj is None:
        return self

    obj_dict = obj.__dict__
    name = self.func.__name__
    with self.lock:
        try:
            # check if the value was computed before the lock was acquired
            return obj_dict[name]

        except KeyError:
            # if not, do the calculation and release the lock
            return obj_dict.setdefault(name, self.func(obj))</code></pre>
</details>
<div class="desc"><p>The client implementation to use for this credential class</p></div>
</dd>
<dt id="exchangelib.credentials.BaseOAuth2Credentials.lock"><code class="name">prop <span class="ident">lock</span></code></dt>
<dd>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">@property
def lock(self):
    return self._lock</code></pre>
</details>
<div class="desc"></div>
</dd>
<dt id="exchangelib.credentials.BaseOAuth2Credentials.scope"><code class="name">prop <span class="ident">scope</span></code></dt>
<dd>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">@property
def scope(self):
    &#34;&#34;&#34;The scope we ask for the token to have&#34;&#34;&#34;
    return [&#34;https://outlook.office365.com/.default&#34;]</code></pre>
</details>
<div class="desc"><p>The scope we ask for the token to have</p></div>
</dd>
<dt id="exchangelib.credentials.BaseOAuth2Credentials.token_url"><code class="name">prop <span class="ident">token_url</span></code></dt>
<dd>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">@property
def token_url(self):
    &#34;&#34;&#34;The URL to request tokens from&#34;&#34;&#34;
    # We may not know (or need) the Microsoft tenant ID. If not, use common/ to let Microsoft select the appropriate
    # tenant for the provided authorization code or refresh token.
    return f&#34;https://login.microsoftonline.com/{self.tenant_id or &#39;common&#39;}/oauth2/v2.0/token&#34;  # nosec</code></pre>
</details>
<div class="desc"><p>The URL to request tokens from</p></div>
</dd>
</dl>
<h3>Methods</h3>
<dl>
<dt id="exchangelib.credentials.BaseOAuth2Credentials.on_token_auto_refreshed"><code class="name flex">
<span>def <span class="ident">on_token_auto_refreshed</span></span>(<span>self, access_token)</span>
</code></dt>
<dd>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def on_token_auto_refreshed(self, access_token):
    &#34;&#34;&#34;Set the access_token. Called after the access token is refreshed (requests-oauthlib can automatically
    refresh tokens if given an OAuth client ID and secret, so this is how our copy of the token stays up-to-date).
    Applications that cache access tokens can override this to store the new token - just remember to call the
    super() method.

    :param access_token: New token obtained by refreshing
    &#34;&#34;&#34;
    # Ensure we don&#39;t update the object in the middle of a new session being created, which could cause a race.
    with self.lock:
        log.debug(&#34;%s auth token for %s&#34;, &#34;Refreshing&#34; if self.access_token else &#34;Setting&#34;, self.client_id)
        self.access_token = access_token</code></pre>
</details>
<div class="desc"><p>Set the access_token. Called after the access token is refreshed (requests-oauthlib can automatically
refresh tokens if given an OAuth client ID and secret, so this is how our copy of the token stays up-to-date).
Applications that cache access tokens can override this to store the new token - just remember to call the
super() method.</p>
<p>:param access_token: New token obtained by refreshing</p></div>
</dd>
<dt id="exchangelib.credentials.BaseOAuth2Credentials.refresh"><code class="name flex">
<span>def <span class="ident">refresh</span></span>(<span>self, session)</span>
</code></dt>
<dd>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def refresh(self, session):
    &#34;&#34;&#34;Obtain a new set of valid credentials. This is intended to support OAuth token refreshing, which can
    happen in long-running applications or those that cache access tokens and so might start with a token close to
    expiration.

    :param session: requests session asking for refreshed credentials
    :return:
    &#34;&#34;&#34;
    # Creating a new session gets a new access token, so there&#39;s no work here to refresh the credentials.</code></pre>
</details>
<div class="desc"><p>Obtain a new set of valid credentials. This is intended to support OAuth token refreshing, which can
happen in long-running applications or those that cache access tokens and so might start with a token close to
expiration.</p>
<p>:param session: requests session asking for refreshed credentials
:return:</p></div>
</dd>
<dt id="exchangelib.credentials.BaseOAuth2Credentials.session_params"><code class="name flex">
<span>def <span class="ident">session_params</span></span>(<span>self)</span>
</code></dt>
<dd>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def session_params(self):
    &#34;&#34;&#34;Extra parameters to use when creating the session&#34;&#34;&#34;
    res = {&#34;token&#34;: self.access_token}  # Token may be None
    if self.client_id and self.client_secret:
        # If we&#39;re given a client ID and secret, we have enough to refresh access tokens ourselves. In other
        # cases the session will raise TokenExpiredError, and we&#39;ll need to ask the calling application to
        # refresh the token (that covers cases where the caller doesn&#39;t have access to the client secret but
        # is working with a service that can provide it refreshed tokens on a limited basis).
        res.update(
            {
                &#34;auto_refresh_kwargs&#34;: {
                    &#34;client_id&#34;: self.client_id,
                    &#34;client_secret&#34;: self.client_secret,
                },
                &#34;auto_refresh_url&#34;: self.token_url,
                &#34;token_updater&#34;: self.on_token_auto_refreshed,
            }
        )
    return res</code></pre>
</details>
<div class="desc"><p>Extra parameters to use when creating the session</p></div>
</dd>
<dt id="exchangelib.credentials.BaseOAuth2Credentials.sig"><code class="name flex">
<span>def <span class="ident">sig</span></span>(<span>self)</span>
</code></dt>
<dd>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">def sig(self):
    # Like hash(self), but pulls in the access token. Protocol.refresh_credentials() uses this to find out
    # if the access_token needs to be refreshed.
    res = []
    for k in self.__dict__:
        if k in (&#34;_lock&#34;, &#34;identity&#34;):
            continue
        if k == &#34;_access_token&#34;:
            res.append(self.access_token[&#34;access_token&#34;] if self.access_token else None)
            continue
        res.append(getattr(self, k))
    return hash(tuple(res))</code></pre>
</details>
<div class="desc"></div>
</dd>
</dl>
</dd>
<dt id="exchangelib.credentials.Credentials"><code class="flex name class">
<span>class <span class="ident">Credentials</span></span>
<span>(</span><span>username, password)</span>
</code></dt>
<dd>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">class Credentials(BaseCredentials):
    r&#34;&#34;&#34;Keeps login info the way Exchange likes it.

    Usernames for authentication are of one of these forms:
    * PrimarySMTPAddress
    * WINDOMAIN\username
    * User Principal Name (UPN)
      password: Clear-text password
    &#34;&#34;&#34;

    EMAIL = &#34;email&#34;
    DOMAIN = &#34;domain&#34;
    UPN = &#34;upn&#34;

    def __init__(self, username, password):
        super().__init__()
        if username.count(&#34;@&#34;) == 1:
            self.type = self.EMAIL
        elif username.count(&#34;\\&#34;) == 1:
            self.type = self.DOMAIN
        else:
            self.type = self.UPN
        self.username = username
        self.password = password

    def __repr__(self):
        return self.__class__.__name__ + repr((self.username, &#34;********&#34;))

    def __str__(self):
        return self.username</code></pre>
</details>
<div class="desc"><p>Keeps login info the way Exchange likes it.</p>
<p>Usernames for authentication are of one of these forms:
* PrimarySMTPAddress
* WINDOMAIN\username
* User Principal Name (UPN)
password: Clear-text password</p></div>
<h3>Ancestors</h3>
<ul class="hlist">
<li><a title="exchangelib.credentials.BaseCredentials" href="#exchangelib.credentials.BaseCredentials">BaseCredentials</a></li>
</ul>
<h3>Class variables</h3>
<dl>
<dt id="exchangelib.credentials.Credentials.DOMAIN"><code class="name">var <span class="ident">DOMAIN</span></code></dt>
<dd>
<div class="desc"><p>The type of the None singleton.</p></div>
</dd>
<dt id="exchangelib.credentials.Credentials.EMAIL"><code class="name">var <span class="ident">EMAIL</span></code></dt>
<dd>
<div class="desc"><p>The type of the None singleton.</p></div>
</dd>
<dt id="exchangelib.credentials.Credentials.UPN"><code class="name">var <span class="ident">UPN</span></code></dt>
<dd>
<div class="desc"><p>The type of the None singleton.</p></div>
</dd>
</dl>
</dd>
<dt id="exchangelib.credentials.O365InteractiveCredentials"><code class="flex name class">
<span>class <span class="ident">O365InteractiveCredentials</span></span>
<span>(</span><span>client_id, username)</span>
</code></dt>
<dd>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">class O365InteractiveCredentials(OAuth2AuthorizationCodeCredentials):
    AUTHORITY = &#34;https://login.microsoftonline.com/organizations&#34;
    SCOPE = [&#34;EWS.AccessAsUser.All&#34;]

    def __init__(self, client_id, username):
        import msal

        app = msal.PublicClientApplication(client_id=client_id, authority=self.AUTHORITY)
        print(&#34;A local browser window will be open for you to sign in. CTRL+C to cancel.&#34;)
        access_token = app.acquire_token_interactive(self.SCOPE, login_hint=username)
        super().__init__(access_token=access_token)</code></pre>
</details>
<div class="desc"><p>Login info for OAuth 2.0 authentication using the authorization code grant type. This can be used in one of
several ways:
* Given an authorization code, client ID, and client secret, fetch a token ourselves and refresh it as needed if
supplied with a refresh token.
* Given an existing access token, client ID, and client secret, use the access token until it expires and then
refresh it as needed.
* Given only an existing access token, use it until it expires. This can be used to let the calling application
refresh tokens itself by subclassing and implementing refresh().</p>
<p>Unlike the base (client credentials) grant, authorization code credentials don't require a Microsoft tenant ID
because each access token (and the authorization code used to get the access token) is restricted to a single
tenant.</p>
<p>:param authorization_code: Code obtained when authorizing the application to access an account. In combination
with client_id and client_secret, will be used to obtain an access token.</p></div>
<h3>Ancestors</h3>
<ul class="hlist">
<li><a title="exchangelib.credentials.OAuth2AuthorizationCodeCredentials" href="#exchangelib.credentials.OAuth2AuthorizationCodeCredentials">OAuth2AuthorizationCodeCredentials</a></li>
<li><a title="exchangelib.credentials.BaseOAuth2Credentials" href="#exchangelib.credentials.BaseOAuth2Credentials">BaseOAuth2Credentials</a></li>
<li><a title="exchangelib.credentials.BaseCredentials" href="#exchangelib.credentials.BaseCredentials">BaseCredentials</a></li>
</ul>
<h3>Class variables</h3>
<dl>
<dt id="exchangelib.credentials.O365InteractiveCredentials.AUTHORITY"><code class="name">var <span class="ident">AUTHORITY</span></code></dt>
<dd>
<div class="desc"><p>The type of the None singleton.</p></div>
</dd>
<dt id="exchangelib.credentials.O365InteractiveCredentials.SCOPE"><code class="name">var <span class="ident">SCOPE</span></code></dt>
<dd>
<div class="desc"><p>The type of the None singleton.</p></div>
</dd>
</dl>
<h3>Inherited members</h3>
<ul class="hlist">
<li><code><b><a title="exchangelib.credentials.OAuth2AuthorizationCodeCredentials" href="#exchangelib.credentials.OAuth2AuthorizationCodeCredentials">OAuth2AuthorizationCodeCredentials</a></b></code>:
<ul class="hlist">
<li><code><a title="exchangelib.credentials.OAuth2AuthorizationCodeCredentials.on_token_auto_refreshed" href="#exchangelib.credentials.BaseOAuth2Credentials.on_token_auto_refreshed">on_token_auto_refreshed</a></code></li>
<li><code><a title="exchangelib.credentials.OAuth2AuthorizationCodeCredentials.refresh" href="#exchangelib.credentials.BaseOAuth2Credentials.refresh">refresh</a></code></li>
<li><code><a title="exchangelib.credentials.OAuth2AuthorizationCodeCredentials.scope" href="#exchangelib.credentials.BaseOAuth2Credentials.scope">scope</a></code></li>
<li><code><a title="exchangelib.credentials.OAuth2AuthorizationCodeCredentials.session_params" href="#exchangelib.credentials.BaseOAuth2Credentials.session_params">session_params</a></code></li>
<li><code><a title="exchangelib.credentials.OAuth2AuthorizationCodeCredentials.token_params" href="#exchangelib.credentials.BaseOAuth2Credentials.token_params">token_params</a></code></li>
<li><code><a title="exchangelib.credentials.OAuth2AuthorizationCodeCredentials.token_url" href="#exchangelib.credentials.BaseOAuth2Credentials.token_url">token_url</a></code></li>
</ul>
</li>
<li><code><b><a title="exchangelib.credentials.BaseOAuth2Credentials" href="#exchangelib.credentials.BaseOAuth2Credentials">BaseOAuth2Credentials</a></b></code>:
<ul class="hlist">
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.client" href="#exchangelib.credentials.BaseOAuth2Credentials.client">client</a></code></li>
</ul>
</li>
</ul>
</dd>
<dt id="exchangelib.credentials.OAuth2AuthorizationCodeCredentials"><code class="flex name class">
<span>class <span class="ident">OAuth2AuthorizationCodeCredentials</span></span>
<span>(</span><span>authorization_code=None, **kwargs)</span>
</code></dt>
<dd>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">class OAuth2AuthorizationCodeCredentials(BaseOAuth2Credentials):
    &#34;&#34;&#34;Login info for OAuth 2.0 authentication using the authorization code grant type. This can be used in one of
    several ways:
    * Given an authorization code, client ID, and client secret, fetch a token ourselves and refresh it as needed if
      supplied with a refresh token.
    * Given an existing access token, client ID, and client secret, use the access token until it expires and then
      refresh it as needed.
    * Given only an existing access token, use it until it expires. This can be used to let the calling application
      refresh tokens itself by subclassing and implementing refresh().

    Unlike the base (client credentials) grant, authorization code credentials don&#39;t require a Microsoft tenant ID
    because each access token (and the authorization code used to get the access token) is restricted to a single
    tenant.
    &#34;&#34;&#34;

    def __init__(self, authorization_code=None, **kwargs):
        &#34;&#34;&#34;

        :param authorization_code: Code obtained when authorizing the application to access an account. In combination
          with client_id and client_secret, will be used to obtain an access token.
        &#34;&#34;&#34;
        for attr in (&#34;client_id&#34;, &#34;client_secret&#34;):
            # Allow omitting these kwargs
            kwargs[attr] = kwargs.pop(attr, None)
        super().__init__(**kwargs)
        self.authorization_code = authorization_code

    @property
    def scope(self):
        res = super().scope
        res.append(&#34;offline_access&#34;)
        return res

    def token_params(self):
        res = super().token_params()
        res[&#34;code&#34;] = self.authorization_code  # Auth code may be None
        self.authorization_code = None  # We can only use the code once
        return res

    @threaded_cached_property
    def client(self):
        return oauthlib.oauth2.WebApplicationClient(client_id=self.client_id)

    def __repr__(self):
        return self.__class__.__name__ + repr(
            (self.client_id, &#34;[client_secret]&#34;, &#34;[authorization_code]&#34;, &#34;[access_token]&#34;)
        )

    def __str__(self):
        client_id = self.client_id
        credential = (
            &#34;[access_token]&#34;
            if self.access_token is not None
            else (&#34;[authorization_code]&#34; if self.authorization_code is not None else None)
        )
        description = &#34; &#34;.join(filter(None, [client_id, credential]))
        return description or &#34;[underspecified credentials]&#34;</code></pre>
</details>
<div class="desc"><p>Login info for OAuth 2.0 authentication using the authorization code grant type. This can be used in one of
several ways:
* Given an authorization code, client ID, and client secret, fetch a token ourselves and refresh it as needed if
supplied with a refresh token.
* Given an existing access token, client ID, and client secret, use the access token until it expires and then
refresh it as needed.
* Given only an existing access token, use it until it expires. This can be used to let the calling application
refresh tokens itself by subclassing and implementing refresh().</p>
<p>Unlike the base (client credentials) grant, authorization code credentials don't require a Microsoft tenant ID
because each access token (and the authorization code used to get the access token) is restricted to a single
tenant.</p>
<p>:param authorization_code: Code obtained when authorizing the application to access an account. In combination
with client_id and client_secret, will be used to obtain an access token.</p></div>
<h3>Ancestors</h3>
<ul class="hlist">
<li><a title="exchangelib.credentials.BaseOAuth2Credentials" href="#exchangelib.credentials.BaseOAuth2Credentials">BaseOAuth2Credentials</a></li>
<li><a title="exchangelib.credentials.BaseCredentials" href="#exchangelib.credentials.BaseCredentials">BaseCredentials</a></li>
</ul>
<h3>Subclasses</h3>
<ul class="hlist">
<li><a title="exchangelib.credentials.O365InteractiveCredentials" href="#exchangelib.credentials.O365InteractiveCredentials">O365InteractiveCredentials</a></li>
</ul>
<h3>Inherited members</h3>
<ul class="hlist">
<li><code><b><a title="exchangelib.credentials.BaseOAuth2Credentials" href="#exchangelib.credentials.BaseOAuth2Credentials">BaseOAuth2Credentials</a></b></code>:
<ul class="hlist">
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.client" href="#exchangelib.credentials.BaseOAuth2Credentials.client">client</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.on_token_auto_refreshed" href="#exchangelib.credentials.BaseOAuth2Credentials.on_token_auto_refreshed">on_token_auto_refreshed</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.refresh" href="#exchangelib.credentials.BaseOAuth2Credentials.refresh">refresh</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.scope" href="#exchangelib.credentials.BaseOAuth2Credentials.scope">scope</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.session_params" href="#exchangelib.credentials.BaseOAuth2Credentials.session_params">session_params</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.token_params" href="#exchangelib.credentials.BaseOAuth2Credentials.token_params">token_params</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.token_url" href="#exchangelib.credentials.BaseOAuth2Credentials.token_url">token_url</a></code></li>
</ul>
</li>
</ul>
</dd>
<dt id="exchangelib.credentials.OAuth2Credentials"><code class="flex name class">
<span>class <span class="ident">OAuth2Credentials</span></span>
<span>(</span><span>client_id, client_secret, tenant_id=None, identity=None, access_token=None)</span>
</code></dt>
<dd>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">class OAuth2Credentials(BaseOAuth2Credentials):
    &#34;&#34;&#34;Login info for OAuth 2.0 client credentials authentication, as well as a base for other OAuth 2.0 grant types.

    This is primarily useful for in-house applications accessing data from a single Microsoft account. For applications
    that will access multiple tenants&#39; data, the client credentials flow does not give the application enough
    information to restrict end users&#39; access to the appropriate account. Use OAuth2AuthorizationCodeCredentials and
    the associated auth code grant type for multi-tenant applications.
    &#34;&#34;&#34;

    @threaded_cached_property
    def client(self):
        return oauthlib.oauth2.BackendApplicationClient(client_id=self.client_id)</code></pre>
</details>
<div class="desc"><p>Login info for OAuth 2.0 client credentials authentication, as well as a base for other OAuth 2.0 grant types.</p>
<p>This is primarily useful for in-house applications accessing data from a single Microsoft account. For applications
that will access multiple tenants' data, the client credentials flow does not give the application enough
information to restrict end users' access to the appropriate account. Use OAuth2AuthorizationCodeCredentials and
the associated auth code grant type for multi-tenant applications.</p>
<p>:param client_id: ID of an authorized OAuth application, required for automatic token fetching and refreshing
:param client_secret: Secret associated with the OAuth application
:param tenant_id: Microsoft tenant ID of the account to access
:param identity: An Identity object representing the account that these credentials are connected to.
:param access_token: Previously-obtained access token, as a dict or an oauthlib.oauth2.OAuth2Token</p></div>
<h3>Ancestors</h3>
<ul class="hlist">
<li><a title="exchangelib.credentials.BaseOAuth2Credentials" href="#exchangelib.credentials.BaseOAuth2Credentials">BaseOAuth2Credentials</a></li>
<li><a title="exchangelib.credentials.BaseCredentials" href="#exchangelib.credentials.BaseCredentials">BaseCredentials</a></li>
</ul>
<h3>Subclasses</h3>
<ul class="hlist">
<li><a title="exchangelib.credentials.OAuth2LegacyCredentials" href="#exchangelib.credentials.OAuth2LegacyCredentials">OAuth2LegacyCredentials</a></li>
</ul>
<h3>Inherited members</h3>
<ul class="hlist">
<li><code><b><a title="exchangelib.credentials.BaseOAuth2Credentials" href="#exchangelib.credentials.BaseOAuth2Credentials">BaseOAuth2Credentials</a></b></code>:
<ul class="hlist">
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.client" href="#exchangelib.credentials.BaseOAuth2Credentials.client">client</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.on_token_auto_refreshed" href="#exchangelib.credentials.BaseOAuth2Credentials.on_token_auto_refreshed">on_token_auto_refreshed</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.refresh" href="#exchangelib.credentials.BaseOAuth2Credentials.refresh">refresh</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.scope" href="#exchangelib.credentials.BaseOAuth2Credentials.scope">scope</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.session_params" href="#exchangelib.credentials.BaseOAuth2Credentials.session_params">session_params</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.token_params" href="#exchangelib.credentials.BaseOAuth2Credentials.token_params">token_params</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.token_url" href="#exchangelib.credentials.BaseOAuth2Credentials.token_url">token_url</a></code></li>
</ul>
</li>
</ul>
</dd>
<dt id="exchangelib.credentials.OAuth2LegacyCredentials"><code class="flex name class">
<span>class <span class="ident">OAuth2LegacyCredentials</span></span>
<span>(</span><span>username, password, **kwargs)</span>
</code></dt>
<dd>
<details class="source">
<summary>
<span>Expand source code</span>
</summary>
<pre><code class="python">class OAuth2LegacyCredentials(OAuth2Credentials):
    &#34;&#34;&#34;Login info for OAuth 2.0 authentication using delegated permissions and application permissions.

    This requires the app to acquire username and password from the user and pass that when requesting authentication
    tokens for the given user. This allows the app to act as the signed-in user.
    &#34;&#34;&#34;

    def __init__(self, username, password, **kwargs):
        &#34;&#34;&#34;
        :param username: The username of the user to act as
        :param password: The password of the user to act as
        &#34;&#34;&#34;
        super().__init__(**kwargs)
        self.username = username
        self.password = password

    def token_params(self):
        res = super().token_params()
        res[&#34;username&#34;] = self.username
        res[&#34;password&#34;] = self.password
        return res

    @threaded_cached_property
    def client(self):
        return oauthlib.oauth2.LegacyApplicationClient(client_id=self.client_id)

    @property
    def scope(self):
        return [&#34;https://outlook.office365.com/EWS.AccessAsUser.All&#34;]</code></pre>
</details>
<div class="desc"><p>Login info for OAuth 2.0 authentication using delegated permissions and application permissions.</p>
<p>This requires the app to acquire username and password from the user and pass that when requesting authentication
tokens for the given user. This allows the app to act as the signed-in user.</p>
<p>:param username: The username of the user to act as
:param password: The password of the user to act as</p></div>
<h3>Ancestors</h3>
<ul class="hlist">
<li><a title="exchangelib.credentials.OAuth2Credentials" href="#exchangelib.credentials.OAuth2Credentials">OAuth2Credentials</a></li>
<li><a title="exchangelib.credentials.BaseOAuth2Credentials" href="#exchangelib.credentials.BaseOAuth2Credentials">BaseOAuth2Credentials</a></li>
<li><a title="exchangelib.credentials.BaseCredentials" href="#exchangelib.credentials.BaseCredentials">BaseCredentials</a></li>
</ul>
<h3>Inherited members</h3>
<ul class="hlist">
<li><code><b><a title="exchangelib.credentials.OAuth2Credentials" href="#exchangelib.credentials.OAuth2Credentials">OAuth2Credentials</a></b></code>:
<ul class="hlist">
<li><code><a title="exchangelib.credentials.OAuth2Credentials.token_params" href="#exchangelib.credentials.BaseOAuth2Credentials.token_params">token_params</a></code></li>
</ul>
</li>
<li><code><b><a title="exchangelib.credentials.OAuth2Credentials" href="#exchangelib.credentials.OAuth2Credentials">OAuth2Credentials</a></b></code>:
<ul class="hlist">
<li><code><a title="exchangelib.credentials.OAuth2Credentials.on_token_auto_refreshed" href="#exchangelib.credentials.BaseOAuth2Credentials.on_token_auto_refreshed">on_token_auto_refreshed</a></code></li>
<li><code><a title="exchangelib.credentials.OAuth2Credentials.refresh" href="#exchangelib.credentials.BaseOAuth2Credentials.refresh">refresh</a></code></li>
<li><code><a title="exchangelib.credentials.OAuth2Credentials.scope" href="#exchangelib.credentials.BaseOAuth2Credentials.scope">scope</a></code></li>
<li><code><a title="exchangelib.credentials.OAuth2Credentials.session_params" href="#exchangelib.credentials.BaseOAuth2Credentials.session_params">session_params</a></code></li>
<li><code><a title="exchangelib.credentials.OAuth2Credentials.token_url" href="#exchangelib.credentials.BaseOAuth2Credentials.token_url">token_url</a></code></li>
</ul>
</li>
<li><code><b><a title="exchangelib.credentials.BaseOAuth2Credentials" href="#exchangelib.credentials.BaseOAuth2Credentials">BaseOAuth2Credentials</a></b></code>:
<ul class="hlist">
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.client" href="#exchangelib.credentials.BaseOAuth2Credentials.client">client</a></code></li>
</ul>
</li>
</ul>
</dd>
</dl>
</section>
</article>
<nav id="sidebar">
<div class="toc">
<ul></ul>
</div>
<ul id="index">
<li><h3>Super-module</h3>
<ul>
<li><code><a title="exchangelib" href="index.html">exchangelib</a></code></li>
</ul>
</li>
<li><h3><a href="#header-classes">Classes</a></h3>
<ul>
<li>
<h4><code><a title="exchangelib.credentials.BaseCredentials" href="#exchangelib.credentials.BaseCredentials">BaseCredentials</a></code></h4>
</li>
<li>
<h4><code><a title="exchangelib.credentials.BaseOAuth2Credentials" href="#exchangelib.credentials.BaseOAuth2Credentials">BaseOAuth2Credentials</a></code></h4>
<ul class="">
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.access_token" href="#exchangelib.credentials.BaseOAuth2Credentials.access_token">access_token</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.client" href="#exchangelib.credentials.BaseOAuth2Credentials.client">client</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.lock" href="#exchangelib.credentials.BaseOAuth2Credentials.lock">lock</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.on_token_auto_refreshed" href="#exchangelib.credentials.BaseOAuth2Credentials.on_token_auto_refreshed">on_token_auto_refreshed</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.refresh" href="#exchangelib.credentials.BaseOAuth2Credentials.refresh">refresh</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.scope" href="#exchangelib.credentials.BaseOAuth2Credentials.scope">scope</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.session_params" href="#exchangelib.credentials.BaseOAuth2Credentials.session_params">session_params</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.sig" href="#exchangelib.credentials.BaseOAuth2Credentials.sig">sig</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.token_params" href="#exchangelib.credentials.BaseOAuth2Credentials.token_params">token_params</a></code></li>
<li><code><a title="exchangelib.credentials.BaseOAuth2Credentials.token_url" href="#exchangelib.credentials.BaseOAuth2Credentials.token_url">token_url</a></code></li>
</ul>
</li>
<li>
<h4><code><a title="exchangelib.credentials.Credentials" href="#exchangelib.credentials.Credentials">Credentials</a></code></h4>
<ul class="">
<li><code><a title="exchangelib.credentials.Credentials.DOMAIN" href="#exchangelib.credentials.Credentials.DOMAIN">DOMAIN</a></code></li>
<li><code><a title="exchangelib.credentials.Credentials.EMAIL" href="#exchangelib.credentials.Credentials.EMAIL">EMAIL</a></code></li>
<li><code><a title="exchangelib.credentials.Credentials.UPN" href="#exchangelib.credentials.Credentials.UPN">UPN</a></code></li>
</ul>
</li>
<li>
<h4><code><a title="exchangelib.credentials.O365InteractiveCredentials" href="#exchangelib.credentials.O365InteractiveCredentials">O365InteractiveCredentials</a></code></h4>
<ul class="">
<li><code><a title="exchangelib.credentials.O365InteractiveCredentials.AUTHORITY" href="#exchangelib.credentials.O365InteractiveCredentials.AUTHORITY">AUTHORITY</a></code></li>
<li><code><a title="exchangelib.credentials.O365InteractiveCredentials.SCOPE" href="#exchangelib.credentials.O365InteractiveCredentials.SCOPE">SCOPE</a></code></li>
</ul>
</li>
<li>
<h4><code><a title="exchangelib.credentials.OAuth2AuthorizationCodeCredentials" href="#exchangelib.credentials.OAuth2AuthorizationCodeCredentials">OAuth2AuthorizationCodeCredentials</a></code></h4>
</li>
<li>
<h4><code><a title="exchangelib.credentials.OAuth2Credentials" href="#exchangelib.credentials.OAuth2Credentials">OAuth2Credentials</a></code></h4>
</li>
<li>
<h4><code><a title="exchangelib.credentials.OAuth2LegacyCredentials" href="#exchangelib.credentials.OAuth2LegacyCredentials">OAuth2LegacyCredentials</a></code></h4>
</li>
</ul>
</li>
</ul>
</nav>
</main>
<footer id="footer">
<p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p>
</footer>
</body>
</html>