Stateless RESTful API and 3rd party authentication

前端 未结 3 1792
谎友^
谎友^ 2021-02-08 19:03

I want to use 3rd party authentication (OpenID, maybe OAuth but I guess OAuth is meant for authorization) so that user can login easily.

But does authenticatin

3条回答
  •  孤街浪徒
    2021-02-08 19:42

    Let's fix understanding issues first. OpenID and OAuth are a bit different. There is a simple way to memorize that different:

    • OpenID is for humans. Simple example: you want to skip boring registration step and let user reuse existing account.
    • OAuth is for services/robots. Simple example: you want your script to access external API with some user's data.

    There is a simple explanation provided by wikipedia:

    Note that with OpenID, the process starts with the application asking the user for their identity (typically an openid URI), whereas in the case of OAuth, the application directly requests a limited access OAuth Token (valet key) to access the APIs (enter the house) on user's behalf. If the user can grant that access, the application can retrieve the unique identifier for establishing the profile (identity) using the APIs.

    enter image description here

    So I want to use 3rd party authentication ... that user can login easily. would probably mean you are going to use OpenID.

    Answering your question: you do not need to call any third-party services on any request. It will be very inefficient and slow. OpenID provider will return user's credentials and you are good to go.

    enter image description here

    Please make sure you have identified requirements correctly.

提交回复
热议问题