Comments (4)
No, I haven't open sourced the showcase app yet. But with the amount of docs and examples here it shouldn't be that hard to figure out what I have on the server.
The first thing is to have configuration for each provider, but in this case I have only the provider's application key
and secret
set. The next important thing is to have a single final callback on your server for all providers, you can set it in server:{callback:'/handle_all'}
. In that route you receive not only the response data from the OAuth flow, but the provider name as well under the provider
key in the querystring or in the session.
The rest of the code is in the browser, I have a web form that makes POST request to the connect route using the Dynamic Override feature. The actual form fields come from yet another JSON configuration that I have compiled by reading each and every provider's developer docs.
from grant.
Maybe you can have a look at the articles listed in this thread #202, specifically this one https://dev.to/simov/oauth-like-a-boss-2m3b. It has an example of how to extract the access token from the callback URL.
Try this:
- add two login buttons on your page using two different providers
- setup Grant and your OAuth apps
- click on those login buttons, in the end you should be redirected back to your login page or some other route
- extract the access token
That's basically what the OAuth Playground app does.
Then you can start playing around with different things: maybe you want to add a little bit of logic in your server routes, or maybe you want to send some dynamic parameters from the browser to configure the login flow. How are you going to persist the user session? Are you going to use a cookie or localStorage, and so on.
Note that for all of those basic cases, at least on the server side, you can simply copy/paste an example from the examples folder, configure it and start using it. Separate example repositories are available for every cloud environment, you can find the links at the bottom of the Handlers section https://github.com/simov/grant#handlers
from grant.
Most excellent! Thanks for the detailed response :)
from grant.
@simov Iβm currently learning grant
. Are you considering open-sourcing the OAuth Playground? Itβd be helpful to learn from π
from grant.
Related Issues (20)
- Intended method of accessing session.grant HOT 2
- Discord Profile route always 401 Unauthorized HOT 7
- Recommended approach for handling config without checking into git HOT 1
- Support Deno? HOT 3
- iFrame redirect issue with Shopify oAuth HOT 4
- OAuth 2 state - how can I associate a successful grant with a user id HOT 5
- Is there a framework-agnostic API? HOT 1
- Telegram Oauth HOT 2
- Export the grant config and Options HOT 4
- Not working with Next 13 App Router
- How to use dynamic params in custom_params of grant? HOT 1
- Autodesk deprecated v1 (lib's current) oauth endpoints HOT 4
- Incorrect inclusion of client_secret for authorization_code grant in OAuth2 implementation HOT 1
- Switch to OAuth 2 for OpenStreetMap provider HOT 1
- Itch.io authentication HOT 2
- Alternating Domains HOT 5
- Allow to customize "missing provider" error URL? HOT 3
- Any Help to Implement Grant in Next JS
- Is it possible to pass arbitrary data in? HOT 1
- Grant playground open-source? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grant.