roll-network / oauth-client-example Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://example-oauth-app.tryroll.com/
Home Page: https://example-oauth-app.tryroll.com/
goals
I am designing this class to achieve these goals with as little assumptions about the consumers implementation as possible.
currently I am allowing the class consumer to decide how they handle:
Initializing the api class will look like this:
const rollAPI = new RollAPI(
clientID,
issuerURL,
redirectURL,
scopes, // array of scopes ["read", "write"...etc]
cacheOauthTokens, // optional function written by consumer to set the oauth tokens in a caching mechanism
getCachedOauthTokens, // optional function to return the cached tokens
clearCachedOauthTokens // optional function to clear cached tokens
);
The consumer will log in like this:
window.location.href = rollAPI.getLoginURL()
//// once the redirect url is hit...
rollAPI.initializeSession(
window.location.search, // the callback url container the ?code=123 param
handleSuccess, // callback to be invoked when the user becomes authenticated, and when tokens are refreshed
handleFail // callback to be invoked when login or refresh fails
);
The consumer will log out like this:
window.location.href = rollAPI.getLogoutURL();
cacheOauthTokens: (oauthTokenOBJ) => void
getCachedOauthTokens: () => oauthTokenOBJ
clearCachedOauthTokens: () => void
handle success: () => void
handleFail: (err) => void
cc @sidko here are some notes on how I am implementing the roll api class.
We need to expand the scope of the sample client example to include write scope.
As part of this issue, we will only test the internal send flow. The user workflow is as follows: I should be able to connect my Roll account to the client-example, approve the permissions, and then tip a user.
The following need to be tested:
The following components are needed on the UI:
Some external users have been using a universal auth token to call read-only API endpoints. We want to move to a system where we are using the auth token of the logged in user to manage all calls for that user. If multiple users are connected, then each users' calls should use that user's auth token. This is until we have a client credential flow where the app can use its own auth token. See https://github.com/TuringAdvisoryGroup/product/issues/19
hasbalance
endpoint is working rightA declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.