https://github.com/casdoor/casdoor-firebase-example
Google Firebase web app example for Casdoor
https://github.com/casdoor/casdoor-firebase-example
auth authentication authn casdoor firebase google iam javascript js oauth oidc react sso ts typescript
Last synced: 7 months ago
JSON representation
Google Firebase web app example for Casdoor
- Host: GitHub
- URL: https://github.com/casdoor/casdoor-firebase-example
- Owner: casdoor
- License: apache-2.0
- Created: 2023-08-27T10:19:55.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2023-09-02T03:35:06.000Z (about 2 years ago)
- Last Synced: 2025-01-13T22:16:18.075Z (9 months ago)
- Topics: auth, authentication, authn, casdoor, firebase, google, iam, javascript, js, oauth, oidc, react, sso, ts, typescript
- Language: JavaScript
- Homepage: https://github.com/casdoor/casdoor
- Size: 1.13 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# casdoor-firebase-example
This is a firebase project uses Casdoor as provider example.
## How to run
### 1. Create a firebase project
Go to [Firebase Console](https://console.firebase.google.com/) to create a project.
#### 1.1. Add Casdoor as provider

You need to enable "Identity Platform" feature first to enable OIDC integration on Firebase.
Select `OpenID Connect` in Custom providers, fill in the following information:
| Name (in order) | Description | Example value |
|-----------------|---------------------------------------|------------------------------------------|
| Name | Any be any string you would like | casdoor |
| Client ID | Client ID for the Casdoor application | 294b09fbc17f95daf2fe |
| Issuer (URL) | Casdoor server URL | https://door.casdoor.com |
| Client Secret | Client secret for Casdoor application | dd8982f7046ccba1bbd7851d5c1ece4e52bf039d |
The above examples values can be retrieved from Casdoor demo site: https://door.casdoor.com/applications/casbin/app-vue-python-example

#### 1.2. Add callback url
Add Callback URL to Casdoor application Redirect URLs:


#### 1.3. Copy project config
Create a `Web app` first:

Copy your project config in project settings to `src/setting.js`. (the following config is our demo site, which can be used for testing. Change it to your own for production use)
```javascript
const firebaseConfig = {
apiKey: "AIzaSyDG8HGY9ULBqXPMIkYEdcOSm2_Yls1E5yY",
authDomain: "fb-casdoor.firebaseapp.com",
projectId: "fb-casdoor",
storageBucket: "fb-casdoor.appspot.com",
messagingSenderId: "174511522903",
appId: "1:174511522903:web:8649d465718acfac900f12",
measurementId: "G-8N504216FH"
};
```
### 2. Install dependencies
```shell
yarn install
```### 3. Run
```shell
yarn start
```