{"id":100269,"date":"2019-03-25T03:21:35","date_gmt":"2019-03-25T03:21:35","guid":{"rendered":"https:\/\/bn.wordpress.org\/plugins\/verify-id-tokens-firebase\/"},"modified":"2019-03-25T03:21:35","modified_gmt":"2019-03-25T03:21:35","slug":"verify-id-tokens-firebase","status":"publish","type":"plugin","link":"https:\/\/pcd.wordpress.org\/plugins\/verify-id-tokens-firebase\/","author":14068367,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_crdt_document":"","version":"1.0.0","stable_tag":"trunk","tested":"5.1.22","requires":"4.7.0","requires_php":"","requires_plugins":"","header_name":"Verify ID Tokens | Firebase","header_author":"Mithun Biswas","header_description":"A plugin to work with Firebase tokens.","assets_banners_color":"","last_updated":"2019-03-25 03:21:35","external_support_url":"","external_repository_url":"","donate_link":"http:\/\/bengal-studio.com\/","header_plugin_uri":"http:\/\/wordpress.org\/plugins\/verify-id-tokens\/","header_author_uri":"http:\/\/bengal-studio.com\/","rating":0,"author_block_rating":0,"active_installs":0,"downloads":1035,"num_ratings":0,"support_threads":0,"support_threads_resolved":0,"author_block_count":0,"sections":["description","installation","changelog"],"tags":[],"upgrade_notice":[],"ratings":[],"assets_icons":[],"assets_banners":[],"assets_blueprints":{},"all_blocks":[],"tagged_versions":[],"block_files":[],"assets_screenshots":[],"screenshots":[],"jetpack_post_was_ever_published":false},"plugin_section":[],"plugin_tags":[14432,169492,169493],"plugin_category":[],"plugin_contributors":[154526],"plugin_business_model":[],"class_list":["post-100269","plugin","type-plugin","status-publish","hentry","plugin_tags-firebase","plugin_tags-firebase-auth","plugin_tags-json-web-tokens","plugin_contributors-bhoot","plugin_committers-bhoot"],"banners":[],"icons":{"svg":false,"icon":"https:\/\/s.w.org\/plugins\/geopattern-icon\/verify-id-tokens-firebase.svg","icon_2x":false,"generated":true},"screenshots":[],"raw_content":"<!--section=description-->\n<p>If your Firebase client app communicates with a custom backend server, you might need to identify the currently signed-in user on that server.<\/p>\n\n<p>This plugin work with Google Firebase tokens. You can use it to verify ID Tokens.<\/p>\n\n<h3>Namespace and Endpoints<\/h3>\n\n<p>When the plugin is activated, a new namespace is added<\/p>\n\n<pre><code>\/verify-id-tokens\/v1\/\n<\/code><\/pre>\n\n<p>Also, a new endpoint is added to this namespace<\/p>\n\n<p><em>\/verify-id-tokens\/v1\/token\/validate<\/em> | POST<\/p>\n\n<h3>PHP HTTP Authorization Header enable<\/h3>\n\n<p>Most of the shared hosting has disabled the <strong>HTTP Authorization Header<\/strong> by default.<\/p>\n\n<p>To enable this option you'll need to edit your <strong>.htaccess<\/strong> file adding the follow<\/p>\n\n<pre><code>RewriteEngine on\nRewriteCond %{HTTP:Authorization} ^(.*)\nRewriteRule ^(.*) - [E=HTTP_AUTHORIZATION:%1]\n<\/code><\/pre>\n\n<h3>WPENGINE<\/h3>\n\n<p>To enable this option you'll need to edit your <strong>.htaccess<\/strong> file adding the follow<\/p>\n\n<pre><code>SetEnvIf Authorization \"(.*)\" HTTP_AUTHORIZATION=$1\n<\/code><\/pre>\n\n<h3>Configurate the Firebase projectId<\/h3>\n\n<p>To add the <strong>projectId<\/strong> edit your wp-config.php file and add a new constant called <strong>BENGAL_STUDIO_VERIFY_ID_TOKENS_FIREBASE_PROJECT_ID<\/strong><\/p>\n\n<pre><code>define('BENGAL_STUDIO_VERIFY_ID_TOKENS_FIREBASE_PROJECT_ID', 'projectId');\n<\/code><\/pre>\n\n<h3>Configurate CORs<\/h3>\n\n<p>The <strong>Verify ID Tokens | Firebase<\/strong> plugin has the option to activate <a href=\"https:\/\/en.wikipedia.org\/wiki\/Cross-origin_resource_sharing\">CORs<\/a> response headers.<\/p>\n\n<p>To enable the CORs edit your wp-config.php file and add a new constant called <strong>BENGAL_STUDIO_VERIFY_ID_TOKENS_ENABLE_CORS<\/strong><\/p>\n\n<pre><code>define('BENGAL_STUDIO_VERIFY_ID_TOKENS_ENABLE_CORS', true);\n<\/code><\/pre>\n\n<h3>Retrieve ID tokens on clients<\/h3>\n\n<p>To retrieve the ID token from the client, make sure the user is signed in and then get the ID token from the signed-in user:<\/p>\n\n<pre><code>firebase.auth().currentUser.getIdToken(\/* forceRefresh *\/ true).then(function(idToken) {\n  \/\/ Send token to your backend via HTTPS\n  \/\/ ...\n}).catch(function(error) {\n  \/\/ Handle error\n});\n<\/code><\/pre>\n\n<h3>Verify ID Tokens<\/h3>\n\n<h4>verify-id-tokens\/v1\/token\/validate<\/h4>\n\n<p>This is a simple helper endpoint to validate a token; you only will need to make a POST request sending the Authorization header.<\/p>\n\n<!--section=installation-->\n<p>This section describes how to install the plugin and get it working.<\/p>\n\n<ol>\n<li>Upload <code>verify-id-tokens<\/code> to the <code>\/wp-content\/plugins\/<\/code> directory<\/li>\n<li>Activate the plugin through the 'Plugins' menu in WordPress<\/li>\n<\/ol>\n\n<!--section=changelog-->\n<h4>1.0.0<\/h4>\n\n<ul>\n<li>Initial release.<\/li>\n<\/ul>","raw_excerpt":"A plugin to work with Firebase tokens.","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin\/100269","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin"}],"about":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/types\/plugin"}],"replies":[{"embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/comments?post=100269"}],"author":[{"embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wporg\/v1\/users\/bhoot"}],"wp:attachment":[{"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/media?parent=100269"}],"wp:term":[{"taxonomy":"plugin_section","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_section?post=100269"},{"taxonomy":"plugin_tags","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_tags?post=100269"},{"taxonomy":"plugin_category","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_category?post=100269"},{"taxonomy":"plugin_contributors","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_contributors?post=100269"},{"taxonomy":"plugin_business_model","embeddable":true,"href":"https:\/\/pcd.wordpress.org\/plugins\/wp-json\/wp\/v2\/plugin_business_model?post=100269"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}