public function Authentication::login in Auth0 Single Sign On 8.2
Makes a call to the `oauth/token` endpoint with `password-realm` grant type.
Parameters
array $options Options for this grant.:
- options.username Username or email of the user logging in; required.
- options.password Password of the user logging in; required.
- options.realm Database realm to use; required.
- options.scope Access token scope requested.
- options.audience API audience identifier for access token.
string|null $ip_address Pass in an IP address to set an Auth0-Forwarded-For header.:
Return value
mixed
Throws
ApiException If username, password, or realm are missing from $options.
File
- vendor/
auth0/ auth0-php/ src/ API/ Authentication.php, line 411
Class
- Authentication
- Class Authentication
Namespace
Auth0\SDK\APICode
public function login(array $options, $ip_address = null) {
if (!isset($options['username'])) {
throw new ApiException('username is mandatory');
}
if (!isset($options['password'])) {
throw new ApiException('password is mandatory');
}
if (!isset($options['realm'])) {
throw new ApiException('realm is mandatory');
}
if (!empty($ip_address)) {
$options['auth0_forwarded_for'] = $ip_address;
}
$options['grant_type'] = 'http://auth0.com/oauth/grant-type/password-realm';
return $this
->oauth_token($options);
}