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
+9-6Lines changed: 9 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -156,6 +156,7 @@ private function getAccountInfo():void
156
156
var myObject:Object = new Object();
157
157
myObject.requestUri = requestUri;
158
158
myObject.sessionId = sessionId;
159
+
myObject.returnSecureToken = true;
159
160
160
161
var request:URLRequest = new URLRequest(FIREBASE_VERIFY_ASSERTION_URL);
161
162
request.method = URLRequestMethod.POST;
@@ -169,10 +170,11 @@ private function getAccountInfo():void
169
170
}
170
171
```
171
172
172
-
We created another `URLRequest` with 2 parameters:
173
+
We created another `URLRequest` with 3 parameters:
173
174
174
175
*`requestUri` is the URI that contains the `code`, this code will be parsed by the Google Identity Toolkit service and then used to retrieve the logged in user profile information from the choosen provider.
175
176
*`sessionId` is from the very start when we requested the `authUri`.
177
+
*`returnSecureToken` is required to obtain a `refreshToken` that will later be exchanged for an `access_token` to authenticate against Firebase Database and Storage.
176
178
177
179
Now we add the `registerComplete` function that will contain the logged in user information.
178
180
@@ -190,8 +192,9 @@ This information is formatted the same for all providers, the most important val
190
192
191
193
Name | Description
192
194
---|---
195
+
`providerId`| A unique id assigned for the provider used in the Sign In process, for example: `facebook.com` or `twitter.com`.
193
196
`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.
194
-
`idToken`| An identity token that is used to identify the current logged in user. The `idToken` is used in further Auth requests such as exchanging it for an `access_token`.
197
+
`refreshToken`| An identity token that is used to identify the current logged in user. The `refreshToken` is used in further Auth requests such as exchanging it for an `access_token`.
195
198
`displayName`| The logged in user full name (Google and Facebook) or their handler in Twitter.
196
199
`photoUrl`| The logged in user avatar.
197
200
`email`| The logged in user email address.
@@ -203,16 +206,16 @@ Once you have the profile information you might want to save it on an Object tha
203
206
## Obtaining and Refreshing an Access Token
204
207
205
208
By default the `access_token` has an expiration time of 60 minutes, you can reset its expiration by requesting a fresh one.
206
-
To obtain or refresh an `access_token` you only need to provide the `idToken` from a Sign In or Verify Account request and specify the `grant_type` as `"authorization_code"`.
209
+
To obtain or refresh an `access_token` you only need to provide a `refreshToken` from a Sign In request and specify the `grant_type` as `"refresh_token"`.
207
210
208
211
```actionscript
209
-
private function refreshToken(idToken:String):void
212
+
private function refreshToken(refreshToken:String):void
210
213
{
211
214
var header:URLRequestHeader = new URLRequestHeader("Content-Type", "application/json");
212
215
213
216
var myObject:Object = new Object();
214
-
myObject.grant_type = "authorization_code";
215
-
myObject.code = idToken;
217
+
myObject.grant_type = "refresh_token";
218
+
myObject.refresh_token = refreshToken;
216
219
217
220
var request:URLRequest = new URLRequest("https://securetoken.googleapis.com/v1/token?key="+FIREBASE_API_KEY);
ToDo App is a mobile application developed with Starling Framework and FeathersUI. It showcases how to use Firebase services with ActionScript to create simple and secure CRUD system.
0 commit comments