OAuth
EZAuth offers a way to authenticate users via OAuth. This is a more secure way to authenticate users and also simplifies the registration process for users.
The following Rules are applied when using OAuth:
-
A new user is created when the user logs in for the first time with oauth (Username and E-Mail get derived from the OAuth Provider)
-
The user can log in with the same OAuth Provider again and again
-
The user can reset his password after logging in with OAuth and is the able to log in without OAuth
-
If there is a user with the same E-Mail as the OAuth Provider, the OAuth will be linked to the existing user
-
OAuth is a full replacement for the normal login process
Google OAuth¶
Setup Google OAuth¶
- Go to the Google Cloud Console.
- Create a new project.
- Go to the APIs & Services -> Credentials section.
- Click on
Create credentials
and selectOAuth client ID
. - Select
Web application
as the application type. - Add the following URIs to the
Authorized redirect URIs
(Where{BASE_URL}
is the Hostname of the server eg.http://test.com
):{BASE_URL}/oauth/google/callback
-
Add the following scopes
-
Click on
Create
and download the credentials as JSON and place them in theconfig
folder. Make sure the name of the file isgoogle_client_secret.env.json
.
GitHub OAuth¶
Setup GitHub OAuth¶
- Go to the GitHub Developer Settings
- Click on
New OAuth App
. - Add the following URIs to the
Authorization callback URL
(Where{BASE_URL}
is the Hostname of the server eg.http://localhost:3250
):{BASE_URL}/oauth/github/callback
- Create the Application and copy the
Client ID
andClient Secret
and create the following file in theconfig
folder.