Skip to content

Commit bb17536

Browse files
committed
Formatting
1 parent 4db9bec commit bb17536

File tree

6 files changed

+27
-25
lines changed

6 files changed

+27
-25
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Firebase in ActionScript
22

3-
Firebase is a back end platform that offers several services to aid in the development of software, especially the ones that rely on server side infraestructure.
3+
Firebase is a back end platform that offers several services to aid in the development of apps and games, specially the ones that rely on server side infrastructure.
44

5-
Some of its services can be accesed by using RESTful techniques. This repository contains detailed guides and examples explaining how to use those services in your `Adobe AIR ` projects.
5+
Some of its services can be accessed by using RESTful techniques. This repository contains detailed guides and [examples](./examples) explaining how to use those services in your `Adobe AIR ` projects.
66

77
You won't need an `ANE` for these guides, all of them work only using `StageWebView`, `URLRequest` and `URLLoader`.
88

@@ -13,7 +13,7 @@ This service allows you to securely authenticate users into your app. It uses Go
1313

1414
* Leverages the use of OAuth, saving time and effort.
1515
* Authenticate with `Facebook`, `Google`, `Twitter`, `Email`, `Anonymous` and more.
16-
* Generates a `tokenId` that can be used for secure operations against Firebase Storage and Firebase Database.
16+
* Generates an `idToken` that can be used for secure operations against Firebase Storage and Firebase Database.
1717

1818
## Firebase Database
1919
*Main guide: [Firebase Database](./database)*
@@ -29,7 +29,7 @@ This service allows you to save and retrieve text based data. Some of its key fe
2929
## Firebase Storage
3030
*Main guide: [Firebase Storage](./storage)*
3131

32-
This service allows you to upload and maintain all kinds of files, including images, sounds, videos and binaries. It uses Google Cloud Messaging to provide this service. Some of its key features are:
32+
This service allows you to upload and maintain all kinds of files, including images, sounds, videos and binaries. It uses Google Cloud Storage to provide this service. Some of its key features are:
3333

3434
* Securely save, retrieve and delete files using rules and Firebase Auth.
3535
* Load end edit metadata from files.
@@ -54,7 +54,7 @@ You can read the guides in any order but it is recommended to start with the [Fi
5454

5555
Firebase ANEs are based on the Android and iOS official SDKs, providing all of their native features.
5656

57-
These guides are based on the JavaScript SDK, keeping the same functionality inside the AIR runtime instead of a web browser.
57+
These guides are based on the JavaScript SDK, while keeping the same functionality inside the AIR runtime instead of a web browser.
5858

5959
### **Which are the benefits of using these guides?**
6060

auth/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ This information is formatted the same for all providers, the most important val
192192
Name | Description
193193
---|---
194194
`localId`| A unique id assigned for the logged in user for your specific Firebase project. This is very useful when working with Firebase Database and Firebase Storage.
195-
`idToken`| An Auth token used to access protected data and files from Firebase Database and Firebase Storage. For more information you can read the Firebase Database and Firebase Storage guides.
195+
`idToken`| An Authentication token that is used to identify the current logged in user. The `idToken` is heavily used in all Firebase features.
196196
`displayName`| The logged in user full name (Google and Facebook) or their handler in Twitter.
197197
`photoUrl`| The logged in user avatar.
198198
`email`| The logged in user email address.
@@ -201,7 +201,7 @@ Note that not all providers return the same information, for example Twitter doe
201201

202202
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.
203203

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.
204+
The `idToken` you receive from this response doesn't work with Firebase Database and Firebase Storage requests. You must exchange it for a new one using the next method. It still works for further Firebase Auth requests.
205205

206206
## Refreshing the idToken
207207

@@ -254,5 +254,5 @@ A successful response will look like the following JSON structure:
254254
}
255255
```
256256

257-
Once you have got the `access_token` you are ready to continue performing secure operations against the Firebase Database and Firebase Storage.
257+
Once you have got the `access_token` you are ready to perform secure operations against the Firebase Database and Firebase Storage services.
258258

auth/email/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ The user will be automatically registered in the Auth section from your Firebase
7878

7979
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.
8080

81-
The `idToken` received from this response does work for `auth` requests.
81+
The `idToken` received from this response does work for the Firebase Database, Firebase Storage and Firebase Auth requests.
8282

8383
## Verifying Credentials (Sign In)
8484

@@ -125,7 +125,8 @@ A successful response will look like the following JSON structure:
125125

126126
Note that failing to enter the correct password 3 times in a row will block the IP for future login attempts for a while.
127127

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).
128+
The `idToken` received from this response doesn't work for Firebase Databasae and Firebase Storage requests. You must refresh the `idToken` to get a functional one (see bottom of this guide).
129+
It does still work for Firebase Auth requests.
129130

130131
## Password Reset
131132

@@ -435,4 +436,6 @@ A successful response will look like the following JSON structure:
435436
"user_id": "ZJ7ud0CEpHYPF6QFWRGTe1U1Gvy2",
436437
"project_id": "545203846422"
437438
}
438-
```
439+
```
440+
441+
Once you have got the `access_token` you are ready to perform secure operations against the Firebase Database and Firebase Storage services.

examples/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ It is strongly recommended to use recent versions of `Adobe AIR` and `Apache Fle
88

99
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).
1010

11-
You will require to enable the `Email` provider for your project, you will also require the following rules in your project:
11+
You will require to enable the `Email` provider for your project, you will also require the following Database rules in your project:
1212

1313
```json
1414
{
@@ -23,7 +23,7 @@ You will require to enable the `Email` provider for your project, you will also
2323

2424
## SimpleCRUD.mxml
2525

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:
26+
An Apache Flex example that demonstrates how to use the Firebase Database with non realtime data. You only require the following Database rules in your project:
2727

2828
```json
2929
{

examples/SimpleChat.mxml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@
9898
}
9999
100100
/*
101-
Refresh token Block
101+
Refresh Token Block
102102
*/
103103
private function refreshToken(idToken:String):void
104104
{
@@ -202,7 +202,7 @@
202202
}
203203
204204
/*
205-
Send Message block
205+
Send Message Block
206206
*/
207207
private function sendMessage():void
208208
{
@@ -227,7 +227,6 @@
227227
228228
private function messageSent(event:flash.events.Event):void
229229
{
230-
trace(event.currentTarget.data);
231230
messageInput.text = "";
232231
}
233232

storage/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
Firebase Storage is based on Google Cloud Storage, a very easy and flexible solution for storing all kinds of files.
44

5-
Files are stored the same way as in your personal computer, using a tree hierarchy. This means there's a root folder, which can contain more folders and those folders can contain additional folders and files.
5+
Files are stored the same way as in your personal computer, using a tree hierarchy. This means there's a root folder which can contain more folders and those folders can contain additional folders and files.
66

77
It is strongly recommended to avoid the use of special characters when naming files and folders.
88

9-
You need to have specific care for the slash character `(/)`. I recommend using this helper function to URL encode them:
9+
You need special care for the slash character `(/)`. I recommend using this helper function to URL encode them:
1010

1111
```actionscript
1212
private function formatUrl(url:String):String
@@ -19,7 +19,7 @@ In the context of this guide a `bucket` is a synonymous to your Firebase project
1919

2020
## Firebase Rules
2121

22-
The Firebase Rules are a flexible way to set permissions on who can access certain data.
22+
The Firebase Rules are a flexible way to set permissions on who can access certain files and data.
2323

2424
By default all the data is private and can only be accessed by Authenticated users.
2525

@@ -72,7 +72,7 @@ service firebase.storage {
7272
}
7373
```
7474

75-
These rules will allow anyone to read the contents of a folder named `public`.
75+
The following rules will allow anyone to read but not to write the contents of a folder named `public`.
7676

7777
```
7878
service firebase.storage {
@@ -88,7 +88,7 @@ service firebase.storage {
8888

8989
To upload a file you require to send it as a `ByteArray`. The following snippets show the most common scenarios.
9090

91-
All of the following examples use the following `Event.COMPLETE` and `IOErrorEvent.IOERROR` listeners.
91+
All of the examples use the following `Event.COMPLETE` and `IOErrorEvent.IOERROR` listeners.
9292

9393
```actionscript
9494
private function uploadComplete(event:flash.events.Event):void
@@ -152,7 +152,7 @@ A successful response will look like the following JSON structure:
152152
}
153153
```
154154

155-
Your new file and `savegames` folder will instantly appear in the Storage section from the Firebase console.
155+
Your new file and a `savegames` folder will instantly appear in the Storage section from the Firebase console.
156156

157157
The download link for this specific file would be:
158158

@@ -162,7 +162,7 @@ The metadata link for this specific file would be:
162162

163163
`https://firebasestorage.googleapis.com/v0/b/<YOUR-PROJECT-ID>.appspot.com/o/savegames%2Fsavegame.data`
164164

165-
Notice that you need to provide the `?alt=media` parameter in order to download the actual file.
165+
Note that you need to provide the `?alt=media` parameter in order to download the actual file.
166166

167167
You will also need to replace all the `/` for `%2F` after the bucket name. Otherwise it will return an error.
168168

@@ -343,7 +343,7 @@ service firebase.storage {
343343
}
344344
```
345345

346-
The following snippet requires that you already have an `idToken` and a `localId`. You can obtain those after a successful Log In or Sign Up. For more information you can read the [Firebase Auth guide](./../auth).
346+
The following snippet requires that you already have a valid `idToken` and a `localId`. You can obtain those after a successful `Refresh Token` request. For more information you can read the [Firebase Auth guide](./../auth).
347347

348348
```actionscript
349349
private function uploadPersonalFile(idToken:String, localId:String):void
@@ -358,7 +358,7 @@ private function uploadPersonalFile(idToken:String, localId:String):void
358358
359359
var header:URLRequestHeader = new URLRequestHeader("Authorization", "Bearer "+idToken);
360360
361-
var request:URLRequest = new URLRequest(FIREBASE_STORAGE_URL+"savegames%2F"+localId+"%2Fsavegame.data");
361+
var request:URLRequest = new URLRequest("https://firebasestorage.googleapis.com/v0/b/<YOUR-PROJECT-ID>.appspot.com/o/"+"savegames%2F"+localId+"%2Fsavegame.data");
362362
request.method = URLRequestMethod.POST;
363363
request.data = bytes;
364364
request.contentType = "text/plain";

0 commit comments

Comments
 (0)