My existing chrome extension has "Sign in with Apple" given that we have iOS users.
When user clicks "Continue with Apple" button in the extension log in pop up, this is what we do:
javascript
window.open(
'https://appleid.apple.com/auth/authorize?client_id=' + clientID + '&redirect_uri=' + backEndURL + '&response_type=id_token%20code&response_mode=form_post&scope=email%20name',
'Sign in with Apple', 'height=500,width=400,left=600,top=200,status=no,location=no,toolbar=no,menubar=no'
)
In chrome, this opens a popup window with that URL.
In Safari Converted Web Extension, it opens custom Apple sign in flow, where it says:
"Do you want to sign in to *** with your Apple ID YYY?"
and then with my mac password I'm able to authenticate.
Afterwards, nothing happens.
Expected: a redirect to the URL specified in the window.open.
Now let's do a trick:
I'll wrap the above window.open code into
javascript
setTimeout (() = {window.open (...)}, 3000)
Because of security reasons, safari then won't open the popup after 3s and will display a notification in the toolbar "Popup blocked..".
If we allow the popup, then it finally opens as a normal window popup and after sign in, it redirects to our backend and it successfully authenticates.
Any ides what how to solve this?
P.S. We're not able to use embedded Sign in with Apple JS - https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js/configuring_your_webpage_for_sign_in_with_apple script because we can't host a remote code in the extension (it will be deprecated soon). So, we arere using this. - https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_js/incorporating_sign_in_with_apple_into_other_platforms
Post
Replies
Boosts
Views
Activity
I'm trying to convert an existing Chrome Extension to Safari Web Extension using this converter - https://developer.apple.com/documentation/safariservices/safari_web_extensions/converting_a_web_extension_for_safari.
Immediately after convert, xcode opens and I build the project with my developer certificate. Everything looks perfect in Safari: the popup works fine, the context menu item is there, options are there.
The moment I restart Safari OR rebuild the project (even without changes), the context menu item disappears.
This is how context menu is defined in my context.js script:
chrome.runtime.onInstalled.addListener(function() {
		chrome.contextMenus.create({
				"title": chrome.i18n.getMessage("contextMenu"),
				"contexts": ["selection"],
				"id": "context" + "selection"
		});
});
chrome.contextMenus.onClicked.addListener(onClickHandler);
My manifest.json has this:
"permissions": ["activeTab", "storage", "contextMenus"],
I followed these instructions - https://developer.apple.com/documentation/safariservices/safari_app_extensions/safari_app_extension_info_property_list_keys/about_contextual_menu_and_toolbar_item_keys and added this key to info.plist in the folder "ProjectName Extension":
<key>SFSafariContextMenu</key>
						<array>
								<dict>
										<key>Text</key>
										<string>Context Menu Text</string>
										<key>Command</key>
										<string>commandMenu</string>
								</dict>
						</array>
After rebuilding the project, nothing changed.
Any ideas how to make context menu consistent?