Package: scribeauth
Scribe AuthMost calls to Scribe's API require authentication and authorization. This library simplifies this process.You first need a Scribe account and a client ID. Both can be requested at support[atsign]scribelabs[dotsign]ai or through Intercom onhttps://platform.scribelabs.aiif you already have a Scribe account.This library interacts directly with our authentication providerAWS Cognitomeaning that your username and password never transit through our servers.InstallationpipinstallscribeauthThis library requires Python >= 3.10 that supports typing.Methods1. Changing passwordfromscribeauthimportScribeAuthaccess=ScribeAuth(client_id)access.change_password('username','password','new_password')2. Recovering an account in case of forgotten passwordfromscribeauthimportScribeAuthaccess=ScribeAuth(client_id)access.forgot_password('username','password','confirmation_code')3. Get or generate tokensWith username and passwordfromscribeauthimportScribeAuthaccess=ScribeAuth(client_id)access.get_tokens(username='username',password='password')With refresh tokenfromscribeauthimportScribeAuthaccess=ScribeAuth(client_id)access.get_tokens(refresh_token='refresh_token')4. Revoking a refresh tokenfromscribeauthimportScribeAuthaccess=ScribeAuth(client_id)access.revoke_refresh_token('refresh_token')5. Getting federated idfromscribeauthimportScribeAuthaccess=ScribeAuth({'client_id':your_client_id,'user_pool_id':your_user_pool_id,'identity_pool_id':your_identity_pool_id})access.get_federated_id('your_id_token')6. Getting federated credentialsfromscribeauthimportScribeAuthaccess=ScribeAuth({'client_id':your_client_id,'user_pool_id':your_user_pool_id,'identity_pool_id':your_identity_pool_id})access.get_federated_credentials('your_federated_id','your_id_token')7. Getting signature for requestfromscribeauthimportScribeAuthaccess=ScribeAuth({'client_id':your_client_id,'user_pool_id':your_user_pool_id,'identity_pool_id':your_identity_pool_id})access.get_signature_for_request(request='your_request',credentials='your_federated_credentials')FlowIf you never have accessed your Scribe account, it probably still contains the temporary password we generated for you. You can change it directly on theplatformor with thechange_passwordmethod. You won't be able to access anything else until the temporary password has been changed.Once the account is up and running, you can request new tokens withget_tokens. You will initially have to provide your username and password. The access and id tokens are valid for up to 30 minutes. The refresh token is valid for 30 days.While you have a valid refresh token, you can request fresh access and id tokens withget_tokensbut using the refresh token this time, so you're not sending your username and password over the wire anymore.In case you suspect that your refresh token has been leaked, you can revoke it withrevoke_token. This will also invalidate any access/id token that has been issued with it. In order to get a new one, you'll need to use your username and password again.You can get your federated id by usingget_federated_idand providing your id token. The federated id will allow you to useget_federated_credentialsto get an access key id, secret key and session token.Every API call to be made to Scribe's API Gateway needs to have a signature. You can get the signature for your request by usingget_signature_for_request. Provide the request you'll be using and your credentials (useget_federated_credentialsto get them).Command lineYou can also use the package as follows for quick access to tokens:python-mscribeauth--client_idclientid--user_pool_iduser_pool_id--usernameusername--passwordpasswordTo flag an issue, open a ticket onGithuband contact us on Intercom through the platform.