What is an Endpoint?

后端 未结 9 1605
不思量自难忘°
不思量自难忘° 2020-12-04 04:39

I have been reading about OAuth and it keeps talking about endpoints. What is exactly an endpoint?

相关标签:
9条回答
  • 2020-12-04 05:10

    Short answer: "an endpoint is an abstraction that models the end of a message channel through which a system can send or receive messages" (Ibsen, 2010).


    Endpoint vs URI (disambiguation)

    The endpoint is not the same as a URI. One reason is because a URI can drive to different endpoints like an endpoint to GET, another to POST, and so on. Example:

    @GET /api/agents/{agent_id} //Returns data from the agent identified by *agent_id*
    @PUT /api/agents/{agent_id} //Update data of the agent identified by *agent_id*
    

    Endpoint vs resource (disambiguation)

    The endpoint is not the same as a resource. One reason is because different endpoints can drive to the same resource. Example:

    @GET /api/agents/{agent_id} @Produces("application/xml") //Returns data in XML format
    @GET /api/agents/{agent_id} @Produces("application/json") //Returns data in JSON format
    
    0 讨论(0)
  • 2020-12-04 05:13

    It's one end of a communication channel, so often this would be represented as the URL of a server or service.

    0 讨论(0)
  • 2020-12-04 05:22

    Come on guys :) We could do it simpler, by examples:

    /this-is-an-endpoint
    /another/endpoint
    /some/other/endpoint
    /login
    /accounts
    /cart/items
    

    and when put under a domain, it would look like:

    https://example.com/this-is-an-endpoint
    https://example.com/another/endpoint
    https://example.com/some/other/endpoint
    https://example.com/login
    https://example.com/accounts
    https://example.com/cart/items
    

    Can be either http or https, we use https in the example.

    Also endpoint can be different for different HTTP methods, for example:

    GET /item/{id}
    PUT /item/{id}
    

    would be two different endpoints - one for retrieving (as in "cRud" abbreviation), and the other for updating (as in "crUd")

    And that's all, really that simple!

    0 讨论(0)
  • 2020-12-04 05:24

    The endpoint of the term is the URL that is focused on creating a request. Take a look at the following examples from different points:

    /api/groups/6/workings/1
    /api/v2/groups/5/workings/2
    /api/workings/3
    

    They can clearly access the same source in a given API.

    0 讨论(0)
  • 2020-12-04 05:25

    Endpoint, in the OpenID authentication lingo, is the URL to which you send (POST) the authentication request.

    Excerpts from Google authentication API

    To get the Google OpenID endpoint, perform discovery by sending either a GET or HEAD HTTP request to https://www.google.com/accounts/o8/id. When using a GET, we recommend setting the Accept header to "application/xrds+xml". Google returns an XRDS document containing an OpenID provider endpoint URL.The endpoint address is annotated as:

    <Service priority="0">
    <Type>http://specs.openid.net/auth/2.0/server</Type> 
    <URI>{Google's login endpoint URI}</URI> 
    </Service>
    

    Once you've acquired the Google endpoint, you can send authentication requests to it, specifying the appropriate parameters (available at the linked page). You connect to the endpoint by sending a request to the URL or by making an HTTP POST request.

    0 讨论(0)
  • 2020-12-04 05:26

    All of the answers posted so far are correct, an endpoint is simply one end of a communication channel. In the case of OAuth, there are three endpoints you need to be concerned with:

    1. Temporary Credential Request URI (called the Request Token URL in the OAuth 1.0a community spec). This is a URI that you send a request to in order to obtain an unauthorized Request Token from the server / service provider.
    2. Resource Owner Authorization URI (called the User Authorization URL in the OAuth 1.0a community spec). This is a URI that you direct the user to to authorize a Request Token obtained from the Temporary Credential Request URI.
    3. Token Request URI (called the Access Token URL in the OAuth 1.0a community spec). This is a URI that you send a request to in order to exchange an authorized Request Token for an Access Token which can then be used to obtain access to a Protected Resource.

    Hope that helps clear things up. Have fun learning about OAuth! Post more questions if you run into any difficulties implementing an OAuth client.

    0 讨论(0)
提交回复
热议问题