Skip to content

trueshail/sharepoint_auth

Repository files navigation

sharepoint_auth

Get sharepoint access token package to access SHAREPOINT REST API.

Sharepoint Access Token

A Flutter sharepoint_auth package for performing authentication to retrieve access token for accessing SHAREPOINT REST API by using OAuth2 v2.0 endpoint. Forked from Earlybyte.aad_oauth AAD Package.

Usage❔

For using this library you have to create an azure app at the Azure App registration portal. Use native app as plattform type.

Register App on Sharepoint Site by using : https://YourDomainName.SharePoint.com/sites/YourSiteName/_layouts/15/appregnew.aspx

Afterwards you have to initialize the library as follow:

 final SharepointConfig config = new SharepointConfig(
      "Sharepoint Client Id",
      "Sharepoint Client Secret",
      "Sharepoint Resource",
      "Sharepoint Site",
      "Your Tenant Id",);
    final Sharepointauth sharepointauth = new Sharepointauth(config);

This allows you to pass in Client Id, Client Secret, Sharepoint Resource, Sharepoint Site and Tenant Id.

Then once you have an Sharepointauth instance, you can call login() and afterwards getAccessToken() to retrieve an access token:

await sharepointauth.login();
String accessToken = await sharepointauth.getAccessToken();

You can also call getAccessToken() directly. It will automatically login and retrive an access token.

Tokens are cached in memory. to destroy the tokens you can call logout():

Tokens have expire offset of 1800 secs:

await sharepointauth.logout();

💻 Installation

Add the following to your pubspec.yaml dependencies:

dependencies:
  sharepoint_auth: "^0.1.0"

👨 Created & Maintained By

Shail Patel

If you found this project helpful or you learned something from the source code and want to thank me, consider buying me a cup of ☕

Say Thanks!

The source code is 100% Dart, and everything resides in the /lib folder.

Show some ❤️ and star the repo to support the project

GitHub followersGitHub stars GitHub forks GitHub watchers Twitter Follow

Open Source Love License

❤️ Found this project useful?

If you found this project useful, then please consider giving it a ⭐ on Github and sharing it.

👍 How to Contribute

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -m 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

📃 License

Copyright 2019 Shail Patel

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Questions?🤔

Hit me on twitter Twitter URL LinkedIn

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.