Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • alimac 182 posts 371 karma points
    Oct 12, 2022 @ 18:18
    alimac
    0

    Has anyone managed to implement PayPal logins with Umbraco?

    I'm trying to setup a site with Paypal logins. I'm using the default Umbraco functionality for the external logins, along with a 3rd party library to handle the authorisation with PayPal: https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers

    I tried using it out-of-the-box only to find that apparently the library auths against live URLs by default. I followed the instructions in this thread: https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers/issues/198 and updated the URLs to the ones mentioned, so I now have the following:

    logins.AddMemberLogin(
    memberAuthenticationBuilder =>
    {
        memberAuthenticationBuilder.AddPaypal(
            // The scheme must be set with this method to work for the umbraco members
            memberAuthenticationBuilder.SchemeForMembers(PayPalMemberExternalLoginProviderOptions.SchemeName),
            options =>
            {
                options.ClientId = clientId;
                options.ClientSecret = clientSecret;
                if (isDevelopment)
                {
                    options.AuthorizationEndpoint = "https://www.sandbox.paypal.com/webapps/auth/protocol/openidconnect/v1/authorize";
                    options.TokenEndpoint = "https://api.sandbox.paypal.com/v1/identity/openidconnect/tokenservice";
                    options.UserInformationEndpoint = "https://api-m.sandbox.paypal.com/v1/identity/oauth2/userinfo?schema=paypalv1.1";
                }
            });
    });
    

    However this approach doesn't seem to work 100% for me. Sometimes it allows me in, other times it doesn't authorize, or seems to kick the user out immediately so that every request involves having to sign in again.

    I was wondering if anyone had successfully implemented this in their project and how they did it?

    I was recommended to use Javascript and their REST APIs but since I'm using Umbraco I'd prefer to use back-end.. but at this point I'm open to anything.

    Thanks

Please Sign in or register to post replies

Write your reply to:

Draft