Google client id

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
ethanlazarus
User
Posts: 63

Google client id

Post by ethanlazarus »

I am trying to set up the google client id login. I set up the google api, and followed the instructions from phpmaker docs:

Note When you configure your project at google.com, the Authorized Rdirect URI should be set as https://www.company.com/basepath/login/Google, replace https://www.company.com/basepath by the real URL of your project.

my site is company.com/patient_portal/
so I entered https://www.company.com/patient_portal/Google

I entered the credentials in phpmaker project, regenerated all files. I click on login with google, it asks for my google id, but then I get error below.

I am getting an error:

401
Unauthorized
You do not have permission to access /patient_portal/index.

What am I doing wrong?


arbei
User
Posts: 9384

Post by arbei »

ethanlazarus wrote:

_Note When you configure your project at google.com, the Authorized Redirect URI should be set as https://www.company.com/basepath/login/Google,

my site is company.com/patient_portal/
so I entered https://www.company.com/patient_portal/Google

Missing "/login" in your Redirect URI.


ethanlazarus
User
Posts: 63

Post by ethanlazarus »

Sorry - that was a typo: the redirect is:

https://www.company.com/patient_portal/login/Google

Still getting that error?


arbei
User
Posts: 9384

Post by arbei »

ethanlazarus wrote:

You do not have permission to access /patient_portal/index.

Make sure you have set up user level security correctly. The user must have permission to at least one page. After Google login, if the user is not found in the users table, the user has no permissions. Read notes in User_CustomValidate:
If you use Advanced Security, you still need the user table to store user information such as User ID and User Level, although the password field value can be empty or any value if you return true.


ethanlazarus
User
Posts: 63

Post by ethanlazarus »

I see - so I am trying to login with google id, but I already have an account, so the id coming from google is not a match to the id stored in the user table. Is there a way I could use custome validate, but then also change the user to the match in the database? for example, when using googleid, does it pass the email address, then I could use custom validate to find the matching email address in my database table, then switch user to that user? Or is this not possible?


arbei
User
Posts: 9384

Post by arbei »

You may simply use User_CustomValidate to change the user name.


Post Reply