PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, July 16, 2022

[FIXED] How to implement a sign-in button of Google and Facebook in a Google AMP?

 July 16, 2022     amp-html, facebook-login, google-signin     No comments   

Issue

I want to create a simple "sign-in" button of Facebook and Google.

I read the documentation (https://amp.dev/documentation/examples/personalization/oauth2_login/#setup) and look at the example in the playground section, but my problem is how do I do this part

"facebook-sign-in": "https://ampbyexample.com/oauth/login/facebook",
"google-sign-in": "https://ampbyexample.com/oauth/login/google",

in example of AMP documentation:

<script id="amp-access" type="application/json">
    {
        "authorization": "https://ampbyexample.com/oauth/status?_=RANDOM",
        "noPingback": "true",
        "login": {
          "facebook-sign-in":"https://ampbyexample.com/oauth/login/facebook",
          "google-sign-in":"https://ampbyexample.com/oauth/login/google",
          "github-sign-in":"https://ampbyexample.com/oauth/login/github",
          "sign-out":"https://ampbyexample.com/oauth/logout"
        },
        "authorizationFallbackResponse": {
            "error": true,
            "loggedIn": false
        }
    }
</script>

What do I do inside of this file https://ampbyexample.com/oauth/login/facebook in my application? what do I need to do it? I'm so confused about this part.

EDIT I found this example but how make this logic with facebook without open a new pop up inside of amp's popup? (https://developers.facebook.com/docs/facebook-login/web) about this example, my login button just stay inside of amp popup... but my expected result is like this example here


Solution

Sign-in with amp-access will always open a new popup. This is to ensure that it's always possible to write first party cookies on your own origin, even if the AMP pages is served from an AMP cache.



Answered By - Sebastian Benz
Answer Checked By - Mary Flores (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

1,261,730

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © 2025 PHPFixing