Skip to content

Commit 36fe315

Browse files
committed
example
1 parent aad2232 commit 36fe315

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

extensions/cache/example_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License. See LICENSE in the project root for license information.
3+
4+
package cache_test
5+
6+
import (
7+
"github.com/AzureAD/microsoft-authentication-extensions-for-go/extensions/accessor/file"
8+
"github.com/AzureAD/microsoft-authentication-extensions-for-go/extensions/cache"
9+
"github.com/AzureAD/microsoft-authentication-library-for-go/apps/public"
10+
)
11+
12+
// This example shows how to configure an MSAL public client to store data in a persistent cache.
13+
func Example() {
14+
path := "path to cache file"
15+
a, err := file.New(path)
16+
if err != nil {
17+
// TODO: handle error
18+
}
19+
c, err := cache.New(a, path)
20+
if err != nil {
21+
// TODO: handle error
22+
}
23+
app, err := public.New("client-id", public.WithCache(c))
24+
if err != nil {
25+
// TODO: handle error
26+
}
27+
28+
_ = app
29+
}

0 commit comments

Comments
 (0)