Giter Club home page Giter Club logo

aras-rest_odata-sample's Introduction

Aras 12 REST Sample

Aras REST API呼叫範例

示範Aras版本: Aras 12.0 SP9 (要Aras 12以上才有支援)

  1. 裡面示範了用js以REST( POST )方式做身分驗證取得登入Token
             //POST的Body參數
             let data = ["grant_type=password", 
                         "scope=Innovator", 
                         "client_id=IOMApp", 
                         "username=登入帳號", 
                         "password=登入密碼", 
                         "database=登入DB"];
             ...
             //這裡示範把Token塞到window以便後面取用(Production別這樣用...拜託...)
             window.arasToken = res.access_token;
  2. 已經取得Token就可以使用Token存取資料啦~~~
         //重點是要把Token在放Header的Authrization標籤中
         xhr.setRequestHeader('Authorization', `Bearer ${window.arasToken}`);

⚠⚠⚠ 這裡有的問題要注意,就是用js會有CORS的問題要處理。基本上OAuth沒有問題,因為OAuth.config本身有CORS的配置... 但是因為後段OData取資料呼叫的URL是~\server\odata,沒有設定CORS的地方就會呼叫失敗... 如果是應用程式(Winform, WPF, 手機APP)就沒有這個問題囉~~

aras-rest_odata-sample's People

Contributors

glenninbcs avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.