How to use the bigcommerce.connection.OAuthConnection.verify_payload function in bigcommerce

To help you get started, we’ve selected a few bigcommerce examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bigcommerce / bigcommerce-api-python / tests / test_connection.py View on Github external
"AYmlnY29tbWVyY2UuY29tIn0sInN0b3JlX2hhc2giOiJsY3R2aD" \
                  "V3bSIsInRpbWVzdGFtcCI6MTM4OTA1MDMyNy42NTc5NjI2fQ==." \
                  "ZTViYzAzNTM2MGFjM2M2YTVkZjFmNzFlYTk4NTY1ODZiMzkxODZmZDExZTdjZGFmOGEzN2E3YTEzNGQ0MmExYw=="
        client_secret = 'ntb1kcxa1do55wf0h25ps7h94fnsoi6'
        user_data = OAuthConnection.verify_payload(payload, client_secret)
        self.assertTrue(user_data) # otherwise verification has failed
        self.assertEqual(user_data['user']['id'], 72)
        self.assertEqual(user_data['user']['email'], "jackie.huynh@bigcommerce.com")

        # Try again with a fake payload
        payload = "notevenreal7ImlkIjo3MiwiZW1haWwiOiJqYWNraWUuaHV5bmh" \
                  "AYmlnY29tbWVyY2UuY29tIn0sInN0b3JlX2hhc2giOiJsY3R2aD" \
                  "V3bSIsInRpbWVzdGFtcCI6MTM4OTA1MDMyNy42NTc5NjI2fQ==." \
                  "quitefakeTM2MGFjM2M2YTVkZjFmNzFlYTk4NTY1ODZiMzkxODZmZDExZTdjZGFmOGEzN2E3YTEzNGQ0MmExYw=="

        user_data = OAuthConnection.verify_payload(payload, client_secret)
        self.assertFalse(user_data)
github bigcommerce / bigcommerce-api-python / tests / test_connection.py View on Github external
def test_verify_payload(self):
        """Decode and verify signed payload."""
        payload = "eyJ1c2VyIjp7ImlkIjo3MiwiZW1haWwiOiJqYWNraWUuaHV5bmh" \
                  "AYmlnY29tbWVyY2UuY29tIn0sInN0b3JlX2hhc2giOiJsY3R2aD" \
                  "V3bSIsInRpbWVzdGFtcCI6MTM4OTA1MDMyNy42NTc5NjI2fQ==." \
                  "ZTViYzAzNTM2MGFjM2M2YTVkZjFmNzFlYTk4NTY1ODZiMzkxODZmZDExZTdjZGFmOGEzN2E3YTEzNGQ0MmExYw=="
        client_secret = 'ntb1kcxa1do55wf0h25ps7h94fnsoi6'
        user_data = OAuthConnection.verify_payload(payload, client_secret)
        self.assertTrue(user_data) # otherwise verification has failed
        self.assertEqual(user_data['user']['id'], 72)
        self.assertEqual(user_data['user']['email'], "jackie.huynh@bigcommerce.com")

        # Try again with a fake payload
        payload = "notevenreal7ImlkIjo3MiwiZW1haWwiOiJqYWNraWUuaHV5bmh" \
                  "AYmlnY29tbWVyY2UuY29tIn0sInN0b3JlX2hhc2giOiJsY3R2aD" \
                  "V3bSIsInRpbWVzdGFtcCI6MTM4OTA1MDMyNy42NTc5NjI2fQ==." \
                  "quitefakeTM2MGFjM2M2YTVkZjFmNzFlYTk4NTY1ODZiMzkxODZmZDExZTdjZGFmOGEzN2E3YTEzNGQ0MmExYw=="

        user_data = OAuthConnection.verify_payload(payload, client_secret)
        self.assertFalse(user_data)
github bigcommerce / bigcommerce-api-python / bigcommerce / api.py View on Github external
def oauth_verify_payload(cls, signed_payload, client_secret):
        return connection.OAuthConnection.verify_payload(signed_payload, client_secret)