Skip to main content
5 votes

How to use the Element API plugin only when logged in?

If you want to restrict the whole API, you can add some code to the top of your /config/elementapi.php file (right below namespace Craft;) that checks for a logged in user, and ends the request with ...
Mats Mikkel Rummelhoff's user avatar
4 votes

Redirecting to another page after a successful user log in

Have you checked this resource mzg? Note: You can customize where users should get redirected to after login via the postLoginRedirect config setting. Then for any pages or templates you want to ...
Cole Henley's user avatar
  • 1,781
3 votes
Accepted

Craft CMS Backing React FE using the element API

I created a react native app with Craft CMS (still version 2.6) as backend using the Element API. But you're right, user authentication is not supported by the Element API. However, I created my own ...
Sven Jungnickel's user avatar
3 votes

How to use LDAP for authentication in Craft CP (back end)

There's a feature request here that would allow custom login forms for the Craft Control Panel login page you might want to add a comment to. In the meantime, there is a userSession....
Brad Bell's user avatar
  • 67.6k
3 votes

Connecting to REST API using Basic Auth

I have built something similar so hopefully this will help get you rolling. You are going to need to (or at least I would) create a plugin that you can call in your twig template. Pay special ...
Damon's user avatar
  • 4,716
2 votes
Accepted

Implementing two factor authentication / TOTP for CP logins

I know this is a little late, but i've just build a plugin for TOTP. It is in beta, so beware before using it in a production environment. https://github.com/born05/craft-twofactorauthentication
Roel's user avatar
  • 148
2 votes

$allowAnonymous = true - not working

If the cron jobs are triggered at the server where your Craft installation is hosted, it might be better to implement a consolecommand instead to execute the logic you want. They are well suited for ...
24HOURSMEDIA's user avatar
2 votes

API Authentication for Craft CMS

You are going to have a hard time if you want to use Yii2 with Craft 2 since they are totally incompatible. Craft 2 uses yii and Craft 3 uses Yii2. You can't mix them. Furthermore you'll need multiple ...
Robin Schambach's user avatar
2 votes
Accepted

Connecting to REST API using Basic Auth

Thank you for pointing me in the right direction! That was super helpful. Here's what I ended with so far. Things may change depending on what I need down the road. It uses Basic Auth like I ...
Jeff Glenn's user avatar
2 votes
Accepted

How to Sign In/Up using social accounts ( Google, Facebook, Apple)?

At the risk of this question being closed for being too vague, maybe you need a starting point? If you want to try your hand at writing a plugin, the first thing I would do is read up on the OAUTH ...
RitterKnight's user avatar
  • 6,582
2 votes
Accepted

How to override UserController.actionLogin or the login form template in Craft 3?

Alright so I was actually misunderstanding how modules work with craft and yii. The init function in your module actually fires before crafts core controllers do, so you could use that to do whatever ...
Myles Hyson's user avatar
1 vote
Accepted

Logging in to Craft via Vue/Javascript apps

And just like that I stumble over this wonderful blog post https://digitalevangelist.net/blog/vuejs-craft-cms-single-page-app-logging-in-to-craft
dmatthams's user avatar
  • 2,502
1 vote
Accepted

Craft CMS module composer dependancy

EDIT: Had to do a sudo pecl install oauth in order to get access to the right OAuth. Had to add the extension to my php.ini and restart my server. public function apiCall($consumer_key, $...
Stef Dg's user avatar
  • 43
1 vote

Craft CMS module composer dependancy

The easiest way around this is to include the required library in your main-project composer.json and let it handle it rather than your modules composer.json. The alternative is to require your ...
Robin Schambach's user avatar
1 vote
Accepted

Craft 3 Element API Authentication/Login

First of all passing the password and username as query strings is one of the most insecure things you can do. It would highly suggest you to not do that unless you want to expose your accounts to ...
Robin Schambach's user avatar
1 vote

Can Auth0 be used for Craft Commerce user accounts?

Craft Commerce and Craft does not support that service out of the box. A Craft plugin would need to created using their PHP Package: https://github.com/auth0/auth0-PHP
Luke Holder's user avatar
  • 6,897
1 vote

Using ADLDAP plugin in Craft 2.6 - can't bind to LDAP

In more testing, I was able to eliminate the "Can't bind to LDAP server!" error message from Craft by removing both: Account Suffix and Admin Account Suffix settings from the ADLDAP parameter control ...
buck1112's user avatar
  • 410
1 vote

Authorization fail

You didn't mention in the post, but you tagged the question with Dukt oAuth. If you're trying to connect with that, Channel Advisor isn't a 1st or 3rd party Dukt oAuth provider. You can see a list ...
Brad Bell's user avatar
  • 67.6k
1 vote

Authentication by a custom field

A possible workaround would be to use the phone numbers as the username. Then you could write a Craft plugin that listened to the onBeforeLogin event and validated the entered phonenumber against ...
Brad Bell's user avatar
  • 67.6k
1 vote

Authentication by a custom field

The short answer is no. Craft does not natively support this, and there's no way to implement it via a hook (or event). A quick browse through the code shows that the UserIdentity::authenticate ...
Stephen Lewis's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible