You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using users service for all authentication(local login, google login,etc). All methods of authentication will create users through users service.
Steps to reproduce
1.)Generate google access token in Frontend(I am using React library react-google-login)
2)Login using google strategy
POST /authentication
body
{
"strategy": "google",
"access_token": "<google access token in step 1>"
}
Expected behavior
Login successfully
Actual behavior
Failed to login
{
"name": "Forbidden",
"message": "You do not have the correct permissions.",
"code": 403,
"className": "forbidden",
"errors": {}
}
What I have tried
I tried to change all methods in before hook in users.hooks.js to
checkPermissions({
roles: [ 'superadmin', 'admin'],
error: false, <-------------------------------------Change to false instead of true
})
It works then, so I think the problems is because of the checkPermissions hook.
Since I want to throw error instantly if permissions not applicable, so the value of error must be true
This discussion was converted from issue #2309 on October 05, 2021 22:49.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Background
I am using
users
service for all authentication(local login, google login,etc). All methods of authentication will create users throughusers
service.Steps to reproduce
1.)Generate
google access token
in Frontend(I am using React libraryreact-google-login
)2)Login using
google
strategyExpected behavior
Login successfully
Actual behavior
Failed to login
What I have tried
I tried to change all methods in before hook in
users.hooks.js
toIt works then, so I think the problems is because of the checkPermissions hook.
Since I want to throw error instantly if permissions not applicable, so the value of
error
must betrue
After that, I tried to do something like this:
The logic is
if users are loggined through google > then do not authenticate jwt and do not need to check permissions
But I find it is not working.
Code
authentication.js
users.hooks.js
Beta Was this translation helpful? Give feedback.
All reactions