How I can reauthorize facebook access token in corona? SHOW STOPPER!

There a big count of scenarios, when I must reauthorize client’s access token.

CORONA TEAM:

How can I do it? Is there method or trick to do it?

Can you give an example?

Scenario 1: ** Token expires after expires time**

Scenario 2: User changes her password

Scenario 3: User de-authorizes your app

Scenario 4: User logs out of Facebook

In all cases I get the following error: 
{“error”:{“message”:“Error validating access token: User XXXXXXXXXX has not authorized application XXXXXXXXXX.”,“type”:“OAuthException”,“code”:190,“error_subcode”:XXX}}

AND NO CHANCE TO LOGIN FACEBOOK!!!

I need implementation some of the following methods of FB SDK:

reauthorizeWithReadPermissions (deprecated)

closeAndClearTokenInformation

 

Is this enough?

Ok, I’m interested in this issue because we are also using a lot of FB features.

Reading the Corona Docs, all FB OAuth stuff is supposed to be handled transparently by Corona. It seems to not be the case in your App. 

On what platform are you seeing this problem?

iOS

Old invalid token is cached by native FB api and I want to initialize “close and clear” cached token after any of these scenarios.

After this, next facebook login renew token from facebook site.

Why not just call facebook.login()?

Rob

Rob - thank you!

**in my case, I used access token for network.request() to my game server.

Problem solved, but:**

 

For all 4 scenarios:

In this case you login in facebook your access token not valid while you make any facebook.request()!

After any ** facebook.request() system initialize reauthorize process, and you get new access token.**

Facebook tokens don’t last forever.  I would say to not make any facebook.requests() until you’ve successfully logged them back in, have a new access token and if your server needs it replace the token on the server. 

Rob

Can you give an example?

Scenario 1: ** Token expires after expires time**

Scenario 2: User changes her password

Scenario 3: User de-authorizes your app

Scenario 4: User logs out of Facebook

In all cases I get the following error: 
{“error”:{“message”:“Error validating access token: User XXXXXXXXXX has not authorized application XXXXXXXXXX.”,“type”:“OAuthException”,“code”:190,“error_subcode”:XXX}}

AND NO CHANCE TO LOGIN FACEBOOK!!!

I need implementation some of the following methods of FB SDK:

reauthorizeWithReadPermissions (deprecated)

closeAndClearTokenInformation

 

Is this enough?

Ok, I’m interested in this issue because we are also using a lot of FB features.

Reading the Corona Docs, all FB OAuth stuff is supposed to be handled transparently by Corona. It seems to not be the case in your App. 

On what platform are you seeing this problem?

iOS

Old invalid token is cached by native FB api and I want to initialize “close and clear” cached token after any of these scenarios.

After this, next facebook login renew token from facebook site.

Why not just call facebook.login()?

Rob

Rob - thank you!

**in my case, I used access token for network.request() to my game server.

Problem solved, but:**

 

For all 4 scenarios:

In this case you login in facebook your access token not valid while you make any facebook.request()!

After any ** facebook.request() system initialize reauthorize process, and you get new access token.**

Facebook tokens don’t last forever.  I would say to not make any facebook.requests() until you’ve successfully logged them back in, have a new access token and if your server needs it replace the token on the server. 

Rob

Hi Rob,

In my case if I deauthorize/delete the app from my facebook account, the next time I login I get the access token error “user has not verified this app”. This happens even if I use login again.

Is there any more to the error message?

Invalidating access token: User XXXX has not authorized application YYYY.

It looks to me the corona app is using the old access token even though I have called login again.

Can you give this another try?

Rob

Hi Rob,

In my case if I deauthorize/delete the app from my facebook account, the next time I login I get the access token error “user has not verified this app”. This happens even if I use login again.