理解the Username-Password OAuth Authentication Flow

來源:互聯網
上載者:User

標籤:style   blog   http   color   使用   strong   

使用者名稱-密碼身分識別驗證流可用於在身分識別驗證,當使用者擁有使用者的憑據時。在這個流程中,使用者的憑據由應用程式使用,用以請求一個存取權杖,如下列步驟中所示。

此oauth身分識別驗證流來回傳遞使用者憑證。僅當必要時,使用此身分識別驗證流。沒有重新整理標記將發行。

 

 

1.The application uses the user’s username and password to request an access token. This is done via an out-of-band POST request to the appropriate Salesforce(客戶管理系統) token request endpoint, such as https://login.salesforce.com/services/oauth2/token. The following request fields(欄位) are required:

An example request body might look something like the following:

grant_type=password&client_id=3MVG9lKcPoNINVBIPJjdw1J9LLM82HnFVVX19KY1uA5mu0QqEWhqKpoW3svG3XHrXDiCQjK1mdgAvhCscA9GE&client_secret=1955279925675241571&username=testuser%40salesforce.com&password=mypassword123456

Salesforce verifies(驗證) the user credentials, and if successful, sends a response to the application with the access token. This response contains the following values:

An example response body might look something like:

{"id":"https://login.salesforce.com/id/00Dx0000000BV7z/005x00000012Q9P","issued_at":"1278448832702","instance_url":"https://na1.salesforce.com","signature":"0CmxinZir53Yex7nE0TD+zMpvIWYGb/bdJh6XfOH6EQ=","access_token":"00Dx0000000BV7z!AR8AQAxo9UfVkh8AlV0Gomt9Czx9LjHnSSpwBMmbRcgKFmxOtvxjTrKW19ye6PE3Ds1eQz3z8jr3W7_VbWmEu4Q8TVGSTHxs"}

3.The application users the provided access token to access protected user data. Keep the Following considrations in mind when using the user-agent Oauth flow:

Since the user is never redirected to login at Salesforce in this flow, the user can’t directly authorize the application, so no refresh tokens can be used. If your application requires refresh tokens, you should consider using the Web server or user-agent OAuth flow.

 

轉載自:http://www.salesforce.com/us/developer/docs/api_rest/Content/intro_understanding_username_password_oauth_flow.htm

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.