{"_id":"5c1d77ffeace490020c1b9d1","project":"550f74bb6fc8130d0038aad3","version":{"_id":"550f75de61d9d30d00af9e01","__v":17,"project":"550f74bb6fc8130d0038aad3","forked_from":"550f74bb6fc8130d0038aad6","createdAt":"2015-03-23T02:09:34.221Z","releaseDate":"2015-03-23T02:09:34.221Z","categories":["550f75de61d9d30d00af9e02","551027e38579861900a86698","551029e08579861900a8669a","551029e7498062190006328a","5bc633a722d682005c9ad9e4","5bc633b08c4b0b000d6a7eaa","5bc633b48f3ff600626e3e18","5bc63538e5a6ba000d22ee6d","5bc63587a18a6b000decd295","5bc635c0937fcb0056223d9c","5bc6360f42f41800319aeaa6","5be5d13ff1d319002baca9ce","5be5d2287cd14d00291fbfdb","5be8b3b09f7cb70023c56a39","5be8b3cbb910100044e20206","5c1d769a4f6aed001fe527f0","5c402942010f0d001496dded"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"3.0.0","version":"3"},"category":{"_id":"5c1d769a4f6aed001fe527f0","project":"550f74bb6fc8130d0038aad3","version":"550f75de61d9d30d00af9e01","__v":0,"sync":{"url":"","isSync":false},"reference":true,"createdAt":"2018-12-21T23:26:18.126Z","from_sync":false,"order":5,"slug":"auth","title":"Key Management"},"user":"56ddd4424acab82000ae9d30","__v":10,"parentDoc":null,"metadata":{"title":"","description":"","image":[]},"updates":["5cf4f15f00e667005d6e9f05"],"next":{"pages":[],"description":""},"createdAt":"2018-12-21T23:32:15.478Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"method":"post","examples":{"codes":[{"language":"python","code":"'''\nThis is a Python 3.7 Module that Submits an Auth Token\nand returns an API key for authentication\n'''\nimport json\nimport secrets\nimport requests\nimport urllib.parse\n\n\nclass WyreApi:\n\n    API_URL = \"https://api.testwyre.com\"\n    API_VER2 = \"/v2\"\n    API_SESSIONS_PATH = \"/sessions/auth/key\"\n\n    def generate_token(self, tok_length=30):\n        '''\n            This method generates a secret token using secrets\n            in Python3\n        '''\n        return secrets.token_hex(tok_length)\n\n    def submitAuthToken(self, token):\n        '''\n            This method submits the secret key / token generated above\n            and to https://api.sendwyre.com/v2/sessions/auth/key\n            and sets API_KEY to the API key returned\n        '''\n        if not token:\n            print(\"Please generate a 25-35 length token\")\n            return\n\n        params = {\n            \"secretKey\": token\n        }\n        url = WyreApi.API_URL + WyreApi.API_VER2 + WyreApi.API_SESSIONS_PATH + \"?\" + \\\n            urllib.parse.urlencode(params, encoding='utf-8')\n\n        response = requests.post(url)\n        if response.status_code == 200:\n            return json.loads(response.text)\n        else:\n            print(response.text)\n\n\nif __name__ == \"__main__\":\n    # create a wyre class object\n    wyre = WyreApi()\n\n    # generate a wyre token\n    token = wyre.generate_token()\n    print(\"Token\", token)\n    # get a secret key\n    response = wyre.submitAuthToken(token)\n    if response:\n        print(\"API KEYS\", response.get('apiKey'))"},{"language":"curl","code":"################### Generate a secrey key ###################\n# On a Linux Environment\ndate +%s | sha256sum | base64 | head -c 32 ; echo\n\n# This will generate a random secret key. Do not lose this key. Once this key is generated, it will be tied to your API Key associated with your account. Here are other ways to generate a secret key in a Linux environmnet. https://www.howtogeek.com/howto/30184/10-ways-to-generate-a-random-password-from-the-command-line/\n\ncurl -XPOST \\\n-H \"Content-Type: application/json\" \\\n-d '{\"secretKey\": \"ENTER YOUR SECRET KEY HERE\"}' \\\nhttps://api.testwyre.com/v2/sessions/auth/key\n\n# This will return a JSON object with your API key. Use our test environment first before going into production.\n\n\n"}]},"results":{"codes":[{"name":"","code":"{\n  \"apiKey\": \"AK-XXXX-YYYYY-ZZZZZ-QQQQQ\",\n  \"authenticatedAs\": null\n}","language":"json","status":200}]},"settings":"","apiSetting":"5c50b085aae6150014b3e80e","auth":"required","params":[{"_id":"5c1d77ffeace490020c1b9d2","ref":"","in":"body","required":false,"desc":"A 25-35 character randomly generated string to use as the key. Any valid JSON string without newlines is acceptable","default":"","type":"string","name":"secretKey"}],"url":"/v2/sessions/auth/key"},"isReference":true,"order":0,"body":"Use this method as describe in [Authentication](doc:authentication#token-auth) to initialize a client-generated bearer token.","excerpt":"Process a client-generated secret key to use as an auth token","slug":"initialize-auth-token","type":"endpoint","title":"Submit Auth Token"}