Azure / static-web-apps

Azure Static Web Apps. For bugs and feature requests, please create an issue in this repo. For community discussions, latest updates, kindly refer to the Discussions Tab. To know what's new in Static Web Apps, visit https://aka.ms/swa/ThisMonth
https://aka.ms/swa
MIT License
330 stars 57 forks source link

Twitter API v2 Authentication Issue #1130

Open Bionic711 opened 1 year ago

Bionic711 commented 1 year ago

I just got access to the Twitter V2 API and setup credentials.

"twitter": {
                "registration": {
                    "consumerKeySettingName": "TWITTER_CONSUMER_KEY",
                    "consumerSecretSettingName": "TWITTER_CONSUMER_SECRET"
                }
}

I also tried this like I have for Facebook

"twitter": {
                "registration": {
                    "consumerKeySettingName": "TWITTER_CONSUMER_KEY",
                    "consumerSecretSettingName": "TWITTER_CONSUMER_SECRET"
                },
                "login": {
                    "scopes":["email"]
                }, 
                "userDetailsClaim": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"
}

When I attempt to log in using Twitter, I receive a 302 from .auth/login/twitter to /.auth/login/twitter?post_login_redirect_uri=/.auth/complete&staticWebAppsAuthNonce=<removed the nonce> which immediately redirects me to my /login/index.html as configured in the staticwebapp.config.json

"401": {
          "redirect": "/login/index.html",
          "statusCode": 302
        },

All my other authentication methods are still working (where when Facebook was not working none of them worked).

I am trying to find out if the Twitter V2 API is supported yet? If it is, how do I make this work? If it is not, what is the ETA to support it?

Bionic711 commented 1 year ago

Still seeking assistance if anyone else is having this issue with the V2 API.

danglingneuron commented 1 year ago

The built in Twitter auth provider has stopped working for me - it was working 2 weeks ago.

Is there any specific reason you are going the custom Twitter auth route?

https://github.com/Azure/static-web-apps/issues/1147#issue-1681711340

Bionic711 commented 1 year ago

I am using the roles via function app feature which requires me to use custom authentication schemas. https://learn.microsoft.com/en-us/azure/static-web-apps/authentication-custom?tabs=aad%2Cinvitations#manage-roles

I am also using Apple, Google, and Facebook, which it is my understanding that those are also only supported under Custom Identity Providers.

danglingneuron commented 1 year ago

Understood. How was your experience adding custom Auth to SWA. Would you please guide me towards custom auth in blazor wasm SWA. I would like to include Google and Facebook in my project. I currently only have microsoft and github.

thomasgauvin commented 1 year ago

Hi folks, we recommend configuring a custom authentication Twitter provider to bypass any issues with the pre-configured provider, recent unannounced changes to the API have resulted in issues in our authentication registration. Here is the link to custom authentication documentation https://learn.microsoft.com/en-us/azure/static-web-apps/authentication-custom?tabs=twitter%2Cinvitations#configure-a-custom-identity-provider