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
Copy file name to clipboardExpand all lines: auth/README.md
+17-2Lines changed: 17 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -201,10 +201,12 @@ Note that not all providers return the same information, for example Twitter doe
201
201
202
202
Once you have the profile information you might want to save it on an Object that can be globally accessed, you will need it when performing Auth requests against Firebase Database and Firebase Storage.
203
203
204
+
The `idToken` you receive from this response doesn't work with `auth` requests. You must exchange it for a new one using the next method.
205
+
204
206
## Refreshing the idToken
205
207
206
208
By default the `idToken` has an expiration time of 60 minutes, you can reset its expiration by requesting a fresh one.
207
-
To refresh an `idToken` you will only need to provide the previous one and specify the `grant_type` as `"authorization_code`.
209
+
To refresh an `idToken` you will only need to provide the previous one and specify the `grant_type` as `"authorization_code"`.
208
210
209
211
```actionscript
210
212
private function refreshToken(idToken:String):void
@@ -238,6 +240,19 @@ private function errorHandler(event:flash.events.IOErrorEvent):void
238
240
}
239
241
```
240
242
243
+
A successful response will look like the following JSON structure:
244
+
245
+
```json
246
+
{
247
+
"access_token": "<A long String>",
248
+
"expires_in": "3600",
249
+
"token_type": "Bearer",
250
+
"refresh_token": "<A long String>",
251
+
"id_token": "<A long String>",
252
+
"user_id": "ZJ7ud0CEpHYPF6QFWRGTe1U1Gvy2",
253
+
"project_id": "545203846422"
254
+
}
255
+
```
256
+
241
257
Once you have got the `access_token` you are ready to continue performing secure operations against the Firebase Database and Firebase Storage.
242
258
243
-
This method applies to both Federated and non Fedarated logins.
Copy file name to clipboardExpand all lines: auth/email/README.md
+56-3Lines changed: 56 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ Firebase provides 2 options when you require a way for your users to log in into
5
5
* Email/Password Auth
6
6
* Anonymous Auth
7
7
8
-
Firebase also uses the Google Identity Toolkit to achieve this.
8
+
Email and Anonymous Auth also uses the Google Identity Toolkit to achieve this.
9
9
10
10
## Getting Started
11
11
@@ -78,7 +78,7 @@ The user will be automatically registered in the Auth section from your Firebase
78
78
79
79
For an Anonymous approach you don't need to specify anything in the request body. You will still get a response similar to the above just without an Email Address.
80
80
81
-
Make sure to save this response inside the app so you can use it later to perform Auth requests and account managing.
81
+
The `idToken` received from this response does work for `auth`requests.
82
82
83
83
## Verifying Credentials (Sign In)
84
84
@@ -125,6 +125,8 @@ A successful response will look like the following JSON structure:
125
125
126
126
Note that failing to enter the correct password 3 times in a row will block the IP for future login attempts for a while.
127
127
128
+
The `idToken` received from this response doesn't work for `auth` requests. You must refresh the `idToken` to get a functional one (see bottom of this guide).
129
+
128
130
## Password Reset
129
131
130
132
To reset a password you only require to provide 2 parameters:
@@ -219,7 +221,7 @@ A successful response will look like the following JSON structure:
219
221
220
222
An email with instructions will be sent to the desired email address. You can customize the template of emails in the Auth section from the Firebase console.
221
223
222
-
## Get Account info
224
+
## Get Account Info
223
225
224
226
This method is used for retrieving the logged in user information, very useful to check if a user has confirmed their Email Address.
225
227
@@ -382,4 +384,55 @@ A successful response will look like the following JSON structure:
382
384
{
383
385
"kind": "identitytoolkit#DeleteAccountResponse"
384
386
}
387
+
```
388
+
389
+
## Refreshing the idToken
390
+
391
+
By default the `idToken` has an expiration time of 60 minutes, you can reset its expiration by requesting a fresh one.
392
+
To refresh an `idToken` you will only need to provide the previous one and specify the `grant_type` as `"authorization_code"`.
393
+
394
+
```actionscript
395
+
private function refreshToken(idToken:String):void
396
+
{
397
+
var header:URLRequestHeader = new URLRequestHeader("Content-Type", "application/json");
398
+
399
+
var myObject:Object = new Object();
400
+
myObject.grant_type = "authorization_code";
401
+
myObject.code = idToken;
402
+
403
+
var request:URLRequest = new URLRequest("https://securetoken.googleapis.com/v1/token?key="+FIREBASE_API_KEY);
Copy file name to clipboardExpand all lines: database/README.md
+1-3Lines changed: 1 addition & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -4,8 +4,6 @@ Firebase offers a very flexible and secure way to save text-based data.
4
4
5
5
This guide will show some of the most common scenarios and it will explain how to use Rules for your database. It is also written from an ActionScript and SQL perspective.
6
6
7
-
A simple `CRUD`[example](./examples) has been provided for your convenience, it only requires a recent version of `Apache Flex` to compile.
8
-
9
7
## Understanding the Data
10
8
11
9
The data saved in the Firebase database is structured like a tree. Each 'branch' can have its own branches and those sub branches can have their own sub branches.
@@ -358,6 +356,6 @@ private function journalLoaded(event:flash.events.Event):void
358
356
}
359
357
```
360
358
361
-
The `localId` and `auth` values can be obtained after a successful Sign In or Sign Up request.
359
+
The `localId` and `auth` values can be obtained after a successful operation with the `Firebase Auth` service.
362
360
363
361
For more information on these values you can read the [Firebase Auth guide](./../auth/).
In this folder you will find several examples on how to use the Firebase services with ActionScript 3.
4
+
5
+
It is strongly recommended to use recent versions of `Adobe AIR` and `Apache Flex`.
6
+
7
+
## SimpleChat.mxml
8
+
9
+
An Apache Flex example that demonstrates how to use the Firebase Database with realtime data and Email auth. This project makes use of the `Responses.as` file that can be found in the [utils folder](./../utils).
10
+
11
+
You will require to enable the `Email` provider for your project, you will also require the following rules in your project:
12
+
13
+
```json
14
+
{
15
+
"rules": {
16
+
"messages": {
17
+
".read": "auth != null",
18
+
".write": "auth != null"
19
+
}
20
+
}
21
+
}
22
+
```
23
+
24
+
## SimpleCRUD.mxml
25
+
26
+
An Apache Flex example that demonstrates how to use the Firebase Database with non realtime data. You only require the following rules in your project:
27
+
28
+
```json
29
+
{
30
+
"rules": {
31
+
"journal": {
32
+
".read": "true",
33
+
".write": "true"
34
+
}
35
+
}
36
+
}
37
+
```
38
+
39
+
## EmailExample.mxml
40
+
41
+
An Apache Flex example that demonstrates how to perform most operations from the Email Auth service, you will only require to provide your Firebase API Key.
42
+
43
+
## FederatedExample.mxml
44
+
45
+
An Apache Flex example that demonstrates how to perform log-in using Google, Twitter and Facebook providers within the same app, you will only require to provide your Firebase API Key.
0 commit comments