File: README.md

package info (click to toggle)
golang-github-azuread-microsoft-authentication-library-for-go 1.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 964 kB
  • sloc: makefile: 4
file content (55 lines) | stat: -rw-r--r-- 1,991 bytes parent folder | download | duplicates (3)
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
# Running the Dev Apps for MSAL Go

To run one of the dev app which uses MSAL Go, the `config.json` file and the `confidential_config.json` should look like the following:

```json
{
    "authority": "https://login.microsoftonline.com/organizations",
    "client_id": "your_client_id",
    "scopes": ["user.read"],
    "username": "your_username",
    "password": "your_password",
    "redirect_uri": "redirect uri registered on the portal",
    "code_challenge": "transformed code verifier from PKCE",  
    "state": "state parameter for authorization code flow",
    "client_secret": "client secret you generated for your app",
    "thumbprint": "the certificate thumbprint defined in your app generation",
    "pem_file": "the file path of your private key pem"
}
```

The dev apps in this repo get tokens for the MS Graph API. To find permissible scopes for MS Graph, visit this [link](https://docs.microsoft.com/graph/permissions-reference). PKCE is explained [here](https://tools.ietf.org/html/rfc7636#section-4.1).

## On Windows

To run the dev samples:
    `cd test/devapps`
  
run the command:
    
    'go run ./ 1'
    
Alternatives:
* 1 build and run "locally"
  * In the devapps folder
  * type 'go build' 
  * type 'devapps.exe 1' to run the device code flow

* 2 (Advanced) install and run from the gobin folder
  * See more: https://golang.org/cmd/go/#hdr-Compile_and_install_packages_and_dependencies
  * In the devapps folder
  * type 'go install' 
  * locate your gobin folder e.g. type 'go env' to find your gobin folder location
  cd to your gobin folder
  * type 'devapps.exe 1' to run the device code flow
  
## On Mac

To run one of the devapps, run the command `go run src/test/devapps/*.go <devapps-number>`. The devapp numbers are as follows:

* 1 - `device_code_flow_sample.go` 
* 2 - `authorization_code_sample.go`
* 3 - `username_password_sample.go`
* 4 - `confidential_auth_code_sample.go`
* 5 - `client_secret_sample.go`
* 6 - `client_certificate_sample.go`