Joel Brewer
Joel Brewer

Reputation: 1652

How to use OAuth with Facebook in a Safari App Extension

My question is similar to How to use OAuth with Github in a Safari extension, however, the answer there explains how to use oauth with the older safari extension API. I am trying to use OAuth with the new Safari App Extension API (https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/SafariAppExtension_PG/).

The new API allows the writing of native code, in addition to providing the ability to inject content scripts. Where should I perform the authentication? I also developed a chrome extension, and Google provides an API for retrieving OAuth tokens (https://developer.chrome.com/apps/identity) -- however I do not see anything similar for Safari App Extensions.

Any help is greatly appreciated!

Upvotes: 2

Views: 353

Answers (1)

Jugoslav M.
Jugoslav M.

Reputation: 76

I am currently working on Safari App Extension similar to your needs and the logic, certs (if you use them) persistence, access and refresh tokens all of them goes to the native code. From the SFSafariExtensionHandler you can control the active window/tab and all the pages in the tab, also receive callbacks from the pages. For the OAuth use any native lib. that solves most of your needs for the logic. I am using this one from AeroGear. Some adaptation will be needed for the page controlling.

Upvotes: 0

Related Questions