{"id":37029865,"url":"https://github.com/microsoftgraph/msgraph-sdk-java-auth","last_synced_at":"2026-01-14T03:36:50.148Z","repository":{"id":54541317,"uuid":"166441552","full_name":"microsoftgraph/msgraph-sdk-java-auth","owner":"microsoftgraph","description":"Authentication Providers for Microsoft Graph Java SDK","archived":true,"fork":false,"pushed_at":"2021-02-11T20:57:30.000Z","size":191,"stargazers_count":34,"open_issues_count":6,"forks_count":22,"subscribers_count":30,"default_branch":"dev","last_synced_at":"2024-04-24T06:32:01.031Z","etag":null,"topics":["devxeng"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/microsoftgraph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-18T16:46:36.000Z","updated_at":"2024-01-29T07:28:41.000Z","dependencies_parsed_at":"2022-08-13T19:10:25.804Z","dependency_job_id":null,"html_url":"https://github.com/microsoftgraph/msgraph-sdk-java-auth","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/microsoftgraph/msgraph-sdk-java-auth","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoftgraph%2Fmsgraph-sdk-java-auth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoftgraph%2Fmsgraph-sdk-java-auth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoftgraph%2Fmsgraph-sdk-java-auth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoftgraph%2Fmsgraph-sdk-java-auth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/microsoftgraph","download_url":"https://codeload.github.com/microsoftgraph/msgraph-sdk-java-auth/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/microsoftgraph%2Fmsgraph-sdk-java-auth/sbom","scorecard":{"id":643605,"data":{"date":"2025-08-11","repo":{"name":"github.com/microsoftgraph/msgraph-sdk-java-auth","commit":"deab6ad47b1f762257e1ed8f7d57d1fdb7838e31"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.2,"checks":[{"name":"Code-Review","score":9,"reason":"Found 9/10 approved changesets -- score normalized to 9","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Binary-Artifacts","score":9,"reason":"binaries present in source code","details":["Warn: binary detected: gradle/wrapper/gradle-wrapper.jar:1"],"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"project is archived","details":["Warn: Repository is archived."],"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T11:27:41.554Z","repository_id":54541317,"created_at":"2025-08-21T11:27:41.554Z","updated_at":"2025-08-21T11:27:41.554Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["devxeng"],"created_at":"2026-01-14T03:36:49.417Z","updated_at":"2026-01-14T03:36:50.136Z","avatar_url":"https://github.com/microsoftgraph.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Microsoft Graph Auth Preview SDK for Java\n\nGet started with the Microsoft Graph SDK for Java by integrating the [Microsoft Graph API](https://developer.microsoft.com/en-us/graph/get-started/java) into your Java application!\n\n## Important Note about the Microsoft Graph Auth Preview SDK for Java\n\nDuring the preview we may make changes to the API, and other mechanisms of this library, which you will be required to take along with bug fixes or feature improvements. This may impact your application. An API change may require you to update your code. When we provide the General Availability release we will require you to update to the General Availability version within six months, as applications written using a preview version of library may no longer work.\n\n## 1. Installation\n\n### 1.1 Install via Gradle\n\nAdd the repository and a compile dependency for `microsoft-graph-auth` to your project's `build.gradle`:\n\n```gradle\nrepository {\n    maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }\n}\n\ndependency {\n    // Include the sdk as a dependency\n    compile('com.microsoft.graph:microsoft-graph-auth:0.3.0-SNAPSHOT')\n}\n```\n\n### 1.2 Install via Maven\nAdd the dependency in `dependencies` in pom.xml\n```xml\n\u003cdependency\u003e\n\t\u003cgroupId\u003ecom.microsoft.graph\u003c/groupId\u003e\n\t\u003cartifactId\u003emicrosoft-graph-auth\u003c/artifactId\u003e\n\t\u003cversion\u003e0.3.0-SNAPSHOT\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nAdd in `project`\n```xml\n\u003cprofiles\u003e\n  \u003cprofile\u003e\n     \u003cid\u003eallow-snapshots\u003c/id\u003e\n        \u003cactivation\u003e\u003cactiveByDefault\u003etrue\u003c/activeByDefault\u003e\u003c/activation\u003e\n     \u003crepositories\u003e\n       \u003crepository\u003e\n         \u003cid\u003esnapshots-repo\u003c/id\u003e\n         \u003curl\u003ehttps://oss.sonatype.org/content/repositories/snapshots\u003c/url\u003e\n         \u003creleases\u003e\u003cenabled\u003efalse\u003c/enabled\u003e\u003c/releases\u003e\n         \u003csnapshots\u003e\u003cenabled\u003etrue\u003c/enabled\u003e\u003c/snapshots\u003e\n       \u003c/repository\u003e\n     \u003c/repositories\u003e\n   \u003c/profile\u003e\n\u003c/profiles\u003e\n\n```\n\n## 2. Getting started\n\n### 2.1 Register your application\n\nRegister your application by following the steps at [Register your app with the Azure AD v2.0 endpoint](https://developer.microsoft.com/en-us/graph/docs/concepts/auth_register_app_v2).\n\n### 2.2 Create an authentication provider object\n\n#### 2.3.1 Confidential client authentication provider\n\n##### a. Authorization code provider\n```java\nAuthorizationCodeProvider authProvider = new AuthorizationCodeProvider(CLIENT_ID, SCOPES, AUTHORIZATION_CODE, REDIRECT_URL, NATIONAL_CLOUD, TENANT, CLIENT_SECRET);\n```\n\n##### b. Client credential provider\n```java\nClientCredentialProvider authProvider = new ClientCredentialProvider(CLIENT_ID, SCOPES, CLIENT_SECRET, TENANT_GUID, NATIONAL_CLOUD);\n```\n#### 2.3.2 Public client authentication provider\n##### a. Username password provider\n```java\nUsernamePasswordProvider authProvider = new UsernamePasswordProvider(CLIENT_ID, SCOPES, USERNAME, PASSWORD, NATIONAL_CLOUD, TENANT, CLIENT_SECRET);\n```\n### 2.3 Get a HttpClient object and make a call\n\n#### Using [msgraph-sdk-java](https://github.com/microsoftgraph/msgraph-sdk-java)\n```java\nIGraphServiceClient graphClient = GraphServiceClient\n\t\t\t\t.builder()\n\t\t\t\t.authenticationProvider(authProvider)\n\t\t\t\t.buildClient();\n\nUser user = graphClient.me().buildRequest().get();\n```\n\n#### Using [msgraph-sdk-java-core](https://github.com/microsoftgraph/msgraph-sdk-java-core)\n```java\nOkHttpClient client = HttpClients.createDefault(authProvider);\nRequest request = new Request.Builder().url(\"https://graph.microsoft.com/v1.0/me\").build();\nResponse response = client.newCall(request).execute();\nSystem.out.println(response.body().string());\n```\n\n## 3. Make requests against the service\n\nAfter you have a GraphServiceClient that is authenticated, you can begin making calls against the service. The requests against the service look like our [REST API](https://developer.microsoft.com/en-us/graph/docs/concepts/overview).\n\n### 3.1 Get the user's drive\n\n#### To retrieve the user's drive:\n##### Using [msgraph-sdk-java](https://github.com/microsoftgraph/msgraph-sdk-java)\n```java\nIGraphServiceClient graphClient = \n\t\tGraphServiceClient\n\t\t.builder()\n\t\t.authenticationProvider(authProvider)\n\t\t.buildClient();\n\t\t\nDrive drive = graphClient.me().drive().buildRequest().get();\n```\n\n##### Using [msgraph-sdk-java-core](https://github.com/microsoftgraph/msgraph-sdk-java-core)\n\n```java\nOkHttpClient httpclient = HttpClients.createDefault(authenticationProvider);\nRequest request = new Request.Builder().url(\"https://graph.microsoft.com/v1.0/me/drive\").build();\nResponse response = client.newCall(request).execute();\nSystem.out.println( respose.body().string() );\n```\n\n## 4. Sample\n### 4.1 Authorization code provider\n\n[Steps to get authorizationCode](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow#request-an-authorization-code)\n```java\nAuthorizationCodeProvider authProvider = new AuthorizationCodeProvider(\"6731de76-14a6-49ae-97bc-6eba6914391e\", \n\t\t\t\tArrays.asList(\"https://graph.microsoft.com/user.read\",\"https://graph.microsoft.com/Mail.ReadWrite\"), \n\t\t\t\tauthorizationCode,\n\t\t\t\t\"http://localhost/myapp/\", \n\t\t\t\tNationalCloud.Global, \n\t\t\t\t\"common\", \n\t\t\t\t\"JqQX2PNo9bpM0uEihUPzyrh\");\n\t\t\t\t\nIGraphServiceClient graphClient = \n\tGraphServiceClient\n\t.builder()\n\t.authenticationProvider(authProvider)\n\t.buildClient();\n\t\t\t\t\nIMessageCollectionPage page = graphClient.me().messages().buildRequest().get();\nwhile(page != null) {\n\tfor(Message message : page.getCurrentPage()) {\n\t\tSystem.out.println(message.subject);\n\t}\n\tIMessageCollectionRequestBuilder builder = page.getNextPage();\n\tif(builder == null)break;\n\tpage = builder.buildRequest().get();\n}\n```\n\n## 5. Documentation\n\nFor more detailed documentation, see:\n\n[Usage of these providers](https://docs.microsoft.com/en-us/azure/active-directory/develop/active-directory-v2-protocols).\n\n## 6. Issues\n\nFor known issues, see [issues](https://github.com/microsoftgraph/msgraph-sdk-java-auth/issues).\n\n## 7. Contributions\n\nThe Microsoft Graph SDK is open for contribution. To contribute to this project, see [Contributing](https://github.com/microsoftgraph/msgraph-sdk-java/blob/master/CONTRIBUTING.md).\n\nThanks to everyone who has already devoted time to improving the library:\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START  --\u003e\n\u003c!-- prettier-ignore --\u003e\n| [\u003cimg src=\"https://avatars3.githubusercontent.com/u/16473684?v=4\" width=\"100px;\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eNakul Sabharwal\u003c/b\u003e\u003c/sub\u003e](https://developer.microsoft.com/graph)\u003cbr /\u003e[](#question-NakulSabharwal \"Answering Questions\") [](https://github.com/microsoftgraph/msgraph-sdk-java/commits?author=NakulSabharwal \"Code\") [](https://github.com/microsoftgraph/msgraph-sdk-java/wiki \"Documentation\") [](#review-NakulSabharwal \"Reviewed Pull Requests\") [](https://github.com/microsoftgraph/msgraph-sdk-java/commits?author=NakulSabharwal \"Tests\")| [\u003cimg src=\"https://avatars2.githubusercontent.com/u/3197588?v=4\" width=\"100px;\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eDeepak Agrawal\u003c/b\u003e\u003c/sub\u003e](https://github.com/deepak2016)\u003cbr /\u003e \n| :---: | :---: | \n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind are welcome!\n\n## 8. Supported Java versions\nThe Microsoft Graph SDK for Java library is supported at runtime for Java 7+ and [Android API revision 15](http://source.android.com/source/build-numbers.html) and greater.\n\n## 9. License\n\nCopyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the [MIT license](LICENSE).\n\n## 10. Third-party notices\n\n[Third-party notices](THIRD%20PARTY%20NOTICES)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoftgraph%2Fmsgraph-sdk-java-auth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmicrosoftgraph%2Fmsgraph-sdk-java-auth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmicrosoftgraph%2Fmsgraph-sdk-java-auth/lists"}