Skip to content

Add ability to initialise API object using OAUTH details #61

@further-reading

Description

@further-reading

The access_token.get method allows you to convert an OAUTH token into an access token for making API commands on a user's behalf for WebexTeams Integrations. However, currently the ciscospark package won't let you call this method unless you have already an API object, which is a problem since you need a token to make an API object even though you don't need a token to make this call!

Luckily, the constructor doesn't actually check if the token you give it is valid on creation. As a workaround, I currently initialise an API object with a fake token, use it to convert the OAUTH code into the new token and then use that new token to create another API object I'll use elsewhere. To demonstrate:

def makeAPI(client_id, client_secret, OAuthcode, redirect_uri):
    fakeAPI = CiscoSparkAPI(access_token='blahblahblah')
    tokenObject = fakeAPI.access_tokens.get(client_id, client_secret, OAuthcode, redirect_uri)
    realAPI = CiscoSparkAPI(access_token=tokenObject.access_token)
    return realAPI

Ideally, I should be able to initialise the API by calling API = CiscoSparkAPI(client_id, client_secret, OAuthcode, redirect_uri) or something like that directly.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions