Skip to content

Instantly share code, notes, and snippets.

@anthonychu
Last active September 10, 2021 22:52
Show Gist options
  • Save anthonychu/46d5104fd120f9bfb92c2603f4b4fd12 to your computer and use it in GitHub Desktop.
Save anthonychu/46d5104fd120f9bfb92c2603f4b4fd12 to your computer and use it in GitHub Desktop.
SWA roles source function testing

SWA roles source functions testing

Creating the app

az account set -s Antares-Demo

az group create -n antchu-swa-roles-function -l centraluseuap

az staticwebapp create -n antchu-swa-roles-function -g antchu-swa-roles-function -s https://github.com/anthonychu/20210903-swa-roles-function -l centraluseuap -b main --app-location frontend --api-location api --login-with-github

Need to change workflow to use Azure/static-web-apps-deploy@latest.

Notes

  • testing is hard
  • twitter missing access token secret
  • would be nice to get openIdIssuer from settings too

Docs

  • Custom auth doc
    • Override a pre-configured auth provider - not all auth providers are pre-configured
    • Change "secure authentication secrets" to "secure custom authentication secrets" - maybe merge this into the custom auth page?
    • AAD needs better instructions
      • aad is the name of the auth provider but config says something else
      • {"code":401,"message":"An error of type 'unsupported_response_type' occurred during the login process: 'AADSTS700054: response_type 'id_token' is not enabled for the application.\r\nTrace ID: 966cd109-c79b-4dce-905d-af4096a75800\r\nCorrelation ID: ac8eedea-e2c7-4cfe-ae34-30321518c744\r\nTimestamp: 2021-09-09 05:26:16Z'"} image
      • Needs more scope
        {
            "error": {
                "code": "Authorization_RequestDenied",
                "message": "Insufficient privileges to complete the operation.",
                "innerError": {
                "date": "2021-09-09T05:39:37",
                "request-id": "f0f59846-5c6a-4fc6-a4d2-a904cb3214c8",
                "client-request-id": "f0f59846-5c6a-4fc6-a4d2-a904cb3214c8"
                }
            }
        }
    • if I hit the login endpoint again, I might get an expired token

AAD Steps

  1. Go to AAD.

  2. Go to App Registrations.

  3. Select New Registration.

  4. Enter name and redirect URI. image

  5. Select Register.

  6. Go to Authentication.

  7. In Implicit grant and hybrid flows, select ID tokens.

  8. Go to Certificates & secrets.

  9. Select New client secret.

  10. Enter name and duration.

  11. Copy Value and set app setting.

  12. Go back to overview.

  13. Copy Application (client) ID and set app setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment