SharePoint

  • 23 Oct

    How to access SharePoint Rest API using OAuth

    Version v2023 is needed and available here.

    Update: A newer and preferred OAuth2 setup is explained in the following blog article: link

    This Authorization method using OAuth2 was tested by a customer of us (Eddy, we really appreciate this). It is based on the following article.

    As mentioned in the article, first you’ll need to register an AD app with your AD Tenant. It will assign you the necessary information you need for the OAuth2 setup

    Feedback customer:

    • This required the following settings in Azure. Maybe only the delegated permissions under Graph are enough, didn’t play too much.

    Sharepoint OAuth2 authorization

    • Also the the redirect url should be set for the app, and ID_token must be enabled.

    Sharepoint OAuth2 authorization

    Limagito File Mover Setup:

    • In this case the Auth Type in our SharePoint setup should be set to: ‘OAuth 2.0 Authorization Code Flow’

    SharePoint OAuth Authentication

    • OAuth2 Setup:
      • Disable ‘Code Challenge’
        • Seems to work also when enabled (tested by customer)
      • Enable ‘Include Nonce’
      • Set ‘Authorization Endpoint URL’
        • https://login.microsoftonline.com/%realm/oauth2/authorize
        • %realm will be replaced by the Realm value (= Tenant or Tenant_ID). You can also enter the full URL including the Tenant.
      • Set ‘Token Endpoint URL’
        • https://login.windows.net/%realm/oauth2/token?api-version=1.0
        • %realm will be replaced by the Realm value (= Tenant or Tenant_ID). You can also enter the full URL including the Tenant.
      • Enter your Client ID and Client Secret (please check the article howto create them)
      • Set ‘Scope’ to:  openid
        • If you don’t receive a Refresh Token, change it to:  openid offline_access
        • Customer used: https://<Tenant>.sharepoint.com/.default
      • Set ‘Resource’ to:  https://graph.microsoft.com/
        • Customer used: https://<Tenant>.sharepoint.com
      • Set Response Mode to:  form_post
      • Set Response Type to:  id_token+code
      • When using %realm in the ‘Authorization or Token Endpoint URL’
        • Please set ‘Realm’ to your Tenant of Tenant_ID

    After the setup, please click on the <Get> button. If you get a firewall popup, you’ll need to accept this otherwise we will not be able to capture the Tokens.

    Follow the steps in the browser and it should fill the Refresh and Access Token afterwards. Do not forget to click <Save>.

    • OAuth2 setup  used by customer (info about the .default Scope: here):

    access SharePoint Rest API using OAuth

    • OAuth2 setup we received from our SharePoint source code provider:

    SharePoint OAuth Authentication

    • Common Setup:

    If you want extra debug information during the test, please enable ‘Add Control Information to Log’

    SharePoint OAuth Authentication

    #Filetransfer #SharePoint

    If you need any help with this ‘how-to-access-sharepoint-rest-api-using-oauth’ option, please let us know.

    Best Regards,

    Limagito Team

  • 25 Nov

    Added SharePoint OAuth2 Authentication in Limagito File Mover

    Added SharePoint OAuth2 Authentication

    Update 28th September 2023, our advice is to use Oauth v2.0 Authentication instead

    In version v2020.22.25.0 we added OAuth2 Authentication as a fourth method for connecting to SharePoint.

    Please select ‘Online Authentication using OUath2’ as Authentication Type (Setup Tab). After selection the OAuth2 Tab will be visible.

    Limagito FileMover SharePoint OAuth2

    We received the following information from the customer (thank you Brad):

    • Client Id
    • Client Secret
    • Redirect URI

     

    Update March 2022

    We had a user getting the following error when trying to Get the OAuth2 Token: AADSTS70000

    He had to change App Domain  to: www.localhost.com

    and

    Redirect URI to the Site url (without the  default.aspx  at the end) in the SharePoint Application setup AND Limagito OAuth2 setup

    We used the information from the customer and added them in the OAuth2 Setup:

    1. Client ID
    2. Client Secret
    3. Scope, we used Web.Manage
    4. Redirect URI

    Limagito File Mover SharePoint OAuth2 Setup

    Next, click <GET>

    At this moment we’ll start a request for the Realm and Principal ID of the SharePoint Site. A Dialog will appear with information about the next step.

    Limagito File Mover SharePoint Bearer Realm

    Now you’ll need to click ‘Trust It’ to continue to the next step:

     

    Limagito File Mover SharePoint Trust It

    The Authorization Code will appear in the address bar of your browser.

    Limagito File Mover SharePoint OAuth2 authorization code

    Please COPY / PASTE this complete URL (https://…) in the ‘Auth Code’ field of the OAth2 Setup screen. We’ll strip the part we need and trigger a request for a Refresh and Access token. The response will be added to the ‘Refresh Token’ and ‘Access Token’ field of the OAuth2 setup.

    Please click <Save> to save these Tokens which we’ll need to connect.

    Limagito File Mover SharePoint OAuth2 RefreshCode

    If you need any help with our ‘SharePoint OAuth2 Authentication’ option, please let us know.

    Best Regards,

    Limagito Team

  • 08 Nov

    Added SharePoint as Source in Limagito File Mover

    In version v2020.11.8 we added SharePoint as Source in Limagito File Mover. Once more, special thanks to Brad who helped us with the test account, much appreciated. In the next couple of weeks we’ll add SharePoint to the Web Remote Tool.

    Limagito File Mover Sharepoint as Source

    SharePoint Source Setup:

    We currently provide 4 authentication methods:

    1. Online Authentication Method:
      • Is the one we used during our tests. The end result of authentication is to establish an HTTP cookie, named “SPOIDCRL”, that contains a binary security token to be sent in subsequent SharePoint HTTPS requests. This cookie is kept in memory (not saved to disk).
      • We need your Username (i.e. myname@mycompany.com) and Password
    2. NTLM Authentication Method (Windows classic mode authentication):
      • For example, imagine our SharePoint endpoint is ‘https://xyzoffice.mycompany.com/’
        • The Site Url would be: https://xyzoffice.mycompany.com
        • The NTLM Domain would be: mycompany.com
        • The Username would be just the name, not a full email address.
          • For example: myname instead of myname@mycompany.com.
    3. Online Authentication using Client Credentials without User Dialog
      • In this case you don’t need to use the Username and Password fields
      • We will use your Client ID and Client Secret from the OAuth2 tab instead
    4. Online Authentication using OAth2

    >Screenshot setup using authentication method 1)

    Limagito File Mover Sharepoint as Source Setup

    >Screenshots setup using authentication method 3)

    Limagito File Mover SharePoint Setup

    Limagito File Mover SharePoint Client Credentials

    SharePoint RunTime Log result

    Limagito File Mover Sharepoint as Source RunTime Log

    If you need any help with ‘SharePoint as Source’, please let us know.

    Best Regards,

    Limagito Team

    By Limagito-Team SharePoint ,
SEARCH