O'Reilly logo

Yii2 By Example by Fabrizio Caldarelli

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Authentication

There are three kinds of authentication:

  • HTTP Basic Auth (the HttpBasicAuth class): This method uses the WWW-Authenticate HTTP header to send the username and password for every request
  • Query parameter (the QueryParamAuth class): This method uses an access token passed as query parameter in the API URL
  • OAuth 2 (the HttpBearerAuth class): This method uses an access token that is obtained by the consumer from an authorization server and sent to the API server via HTTP bearer tokens

Yii supports all the methods mentioned, but we can also easily create a new one.

To enable authentication, follow these steps:

  1. Configure the user application component in the configuration, setting enableSession to false in order to make user authentication status ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required